Strange behavior with static arrays in g++

2008-05-28 Thread Dave Carrigan
Hi,

I'm using GNU g++, and am declaring a static global array of button IDs,
like so:

  const UInt16 ButtonIDs[] = {
  Button1,
  Button2,
  Button3
  };

However, when I try to do something like FrmGetObjectIndex() using one
of these array values, pose complains about object not in form. 

When I look at the array in gdb, it has the correct values:

  (gdb) print ButtonIDs
  $1 = {1001, 1002, 1003}

But, I added code to examine the array using

  HostFPrintF(fh, The array contains %hu, %hu, %hu\n, 
  ButtonIDs[0], ButtonIDs[2], ButtonIDs[2])

And, I get

  The array contains 1036, 3592, 36354

If I declare the array as

  UInt16 ButtonIDs[3];

and then initialize the array in my frmOpenEvent, my code works
fine. 

Is there anybody who has seen this before and can shed some light on it?

-- 
Dave Carrigan ([EMAIL PROTECTED])| Yow! Now I need a suntan, a
UNIX-Apache-Perl-Linux-Firewalls-LDAP-C-DNS | tennis lesson, Annette Funicello
Seattle, WA, USA| and two dozen Day-Glo orange
http://www.rudedog.org/ | paper jumpsuits!!


-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/


Re: Strange behavior with static arrays in g++

2001-04-30 Thread David Leland

Just wondered if anyone had an answer for this?  I've run into the same
thing.

Dave

Dave Carrigan [EMAIL PROTECTED] wrote in message
news:30250@palm-dev-forum...

 Hi,

 I'm using GNU g++, and am declaring a static global array of button IDs,
 like so:

   const UInt16 ButtonIDs[] = {
   Button1,
   Button2,
   Button3
   };

 However, when I try to do something like FrmGetObjectIndex() using one
 of these array values, pose complains about object not in form.

 When I look at the array in gdb, it has the correct values:

   (gdb) print ButtonIDs
   $1 = {1001, 1002, 1003}

 But, I added code to examine the array using

   HostFPrintF(fh, The array contains %hu, %hu, %hu\n,
   ButtonIDs[0], ButtonIDs[2], ButtonIDs[2])

 And, I get

   The array contains 1036, 3592, 36354

 If I declare the array as

   UInt16 ButtonIDs[3];

 and then initialize the array in my frmOpenEvent, my code works
 fine.

 Is there anybody who has seen this before and can shed some light on it?

 --
 Dave Carrigan ([EMAIL PROTECTED])| Yow! Now I need a suntan, a
 UNIX-Apache-Perl-Linux-Firewalls-LDAP-C-DNS | tennis lesson, Annette
Funicello
 Seattle, WA, USA| and two dozen Day-Glo orange
 http://www.rudedog.org/ | paper jumpsuits!!





-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/