Re: sizeof(DateType) == 2 ?

2008-05-28 Thread Jamie Macleod
in message news:[EMAIL PROTECTED] From: Jamie Macleod [EMAIL PROTECTED] Subject: sizeof(DateType) == 2 ? Can someone explain why sizeof(DateType) gives me 2? DateType is a structure declared as 3 UInt16 values, and of course if I do a (sizeof(UInt16) * 3) I get 6. Shouldn't I be getting 6

Re: sizeof(DateType) == 2 ?

2008-05-28 Thread Garth Watkins
Forum palm-dev-forum@news.palmos.com Sent: Sunday, November 05, 2000 4:50 PM Subject: sizeof(DateType) == 2 ? Can someone explain why sizeof(DateType) gives me 2? DateType is a structure declared as 3 UInt16 values, and of course if I do a (sizeof(UInt16) * 3) I get 6. Shouldn't I be getting

sizeof(DateType) == 2 ?

2008-05-28 Thread Jamie Macleod
Can someone explain why sizeof(DateType) gives me 2? DateType is a structure declared as 3 UInt16 values, and of course if I do a (sizeof(UInt16) * 3) I get 6. Shouldn't I be getting 6 for DateType? Jamie -- For information on using the ACCESS Developer Forums, or to unsubscribe, please

sizeof returns incorrect value

2005-03-17 Thread mguo
I am using CodeWarrior8.3. I have a following structure, when i use sizeof on this structure, it returns 12, but i expect 8. Does anybody know why? Thanks, -mguo typedef struct { union { UInt32 u1; UInt32 u2; }; union { UInt16 u3; UInt16 u4; }; union

Re: sizeof returns incorrect value

2005-03-17 Thread Wade Guthrie
mguo wrote: I am using CodeWarrior8.3. I have a following structure, when i use sizeof on this structure, it returns 12, but i expect 8. Does anybody know why? Thanks, -mguo typedef struct { union { UInt32 u1; UInt32 u2; }; union { UInt16 u3; UInt16 u4; }; union

Re: sizeof returns incorrect value

2005-03-17 Thread Ingbert Grimpe
On Thu, 17 Mar 2005 18:23:19 -, mguo [EMAIL PROTECTED] wrote: I am using CodeWarrior8.3. I have a following structure, when i use sizeof on this structure, it returns 12, but i expect 8. Just because you 'expect' something, it doesn't need to be correct ;) Does anybody know why? Thanks

Re: sizeof returns incorrect value

2005-03-17 Thread mguo
Thanks for quick response, Wade and Ingbert! actually, alignment is also what i thought. i double-checked my target setting, which is 68k, not 68k-4byte. so it should use 2-byte alignment. Even if 68k-4byte, compiler shouldn't pad 2 extra bytes after union2 and union3, because the total size of

Re: sizeof returns incorrect value

2005-03-17 Thread mguo
i use #pragma options align=mac68k to force 2-byte alignment, it still does the same thing. It might be a bug in compiler, I guess. -mguo -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Re: sizeof returns incorrect value

2005-03-17 Thread Jan Slodicka
Subject: Re: sizeof returns incorrect value i use #pragma options align=mac68k to force 2-byte alignment, it still does the same thing. It might be a bug in compiler, I guess. -mguo -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev

Re: sizeof returns incorrect value

2005-03-17 Thread Ingbert Grimpe
On Thu, 17 Mar 2005 19:07:49 -, mguo [EMAIL PROTECTED] wrote: i use #pragma options align=mac68k to force 2-byte alignment, it still Have you tried 'packed' for this structure? -- For information on using the Palm Developer Forums, or to unsubscribe, please see

sizeof enumerated type

2004-12-27 Thread Sinisa Marovic (AC/EDD)
Hi, I have a small problem using prc tools 2.3. I'm using EvtGetEvent function within a PNOlet, and I'm using standard (sdk-5) EventType definition in Event.h. The problem is that none of the events seems to be recognized in the loop. When I printed a value of the eType field, I could

OS 5.0 5.3 Headers Give Diff Results for sizeof(MyStruct)

2004-01-15 Thread Mike McCollister
Here is a structure that I have been using: typedef struct MyColorTableType { Int16 numEntries; UInt8 fill[2]; RGBColorType entry[UILastColorTableEntry]; } MyStruct; When I compile using the OS 5.0 header files, I get sizeof(MyStruct) = 124. However, when I compile using the OS 5.3

Re: OS 5.0 5.3 Headers Give Diff Results for sizeof(MyStruct)

2004-01-15 Thread Mike McCollister
numEntries; UInt8 fill[2]; RGBColorType entry[UILastColorTableEntry]; } MyStruct; When I compile using the OS 5.0 header files, I get sizeof(MyStruct) = 124. However, when I compile using the OS 5.3 header files, I get sizeof(MyStruct) = 128. The OS 5.0 result is the corrent one

Re: CodeWarrior: #IF SIZEOF(struct) == X ?

2003-12-20 Thread Ben Combee
At 05:02 PM 12/19/2003, Peter Easton wrote: Hi, I'm looking to receive some kind of compile-time notification if a structure size isn't what I'd expect it to be. Something like: #IF SIZEOF(MyStructType) != 100 DISPLAY Oops, there's problem You can't do this with the preprocessor since it doesn't

CodeWarrior: #IF SIZEOF(struct) == X ?

2003-12-19 Thread Peter Easton
Hi, I'm looking to receive some kind of compile-time notification if a structure size isn't what I'd expect it to be. Something like: #IF SIZEOF(MyStructType) != 100 DISPLAY Oops, there's problem Thanks, Peter -- For information on using the Palm Developer Forums, or to unsubscribe

Re: CodeWarrior: #IF SIZEOF(struct) == X ?

2003-12-19 Thread John Marshall
Peter Easton [EMAIL PROTECTED] wrote: I'm looking to receive some kind of compile-time notification if a structure size isn't what I'd expect it to be. Something like: #IF SIZEOF(MyStructType) != 100 DISPLAY Oops, there's problem Sadly the sizeof operator is not available

Re: sizeof

2003-08-14 Thread Engi
On Saturday, August 09, 2003 9:35 PM [GMT+1=CET], Carsten [EMAIL PROTECTED] wrote: most (some.. ;) compliers have the ability to define the struct alignment. Is it the case with CW ? -- For information on using the Palm Developer Forums, or to unsubscribe, please see

Re: sizeof

2003-08-14 Thread Jeremy Neal Kelly
rguevara [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Because the Char allocate one more bit for '\0' Sorry, but this is definitely *not* correct; see Ben Combee's earlier post for the correct answer. Jeremy Neal Kelly Software Engineer Peapod -- For information on using the

Re: sizeof

2003-08-14 Thread Ben Combee
At 10:00 AM 8/8/2003, Engi wrote: Hi, Is someone could explain me this : sizeof(DateType) = 2 sizeof(Char) = 1 typedef struct { DateType date; Char value; } stACTIONS; sizeof(stACTIONS) = 4 ??? Why sizeof(stACTIONS) is not 3 ? Because stActions has to be aligned on a two-byte boundary

Re: sizeof

2003-08-09 Thread Carsten
most (some.. ;) compliers have the ability to define the struct alignment. -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Re: sizeof

2003-08-09 Thread Ben Combee
At 02:43 PM 8/9/2003, Engi wrote: On Saturday, August 09, 2003 9:35 PM [GMT+1=CET], Carsten [EMAIL PROTECTED] wrote: most (some.. ;) compliers have the ability to define the struct alignment. Is it the case with CW ? Have you tried reading the compiler manual (hint - search for packed). -- Ben

sizeof

2003-08-08 Thread Engi
Hi, Is someone could explain me this : sizeof(DateType) = 2 sizeof(Char) = 1 typedef struct { DateType date; Char value; } stACTIONS; sizeof(stACTIONS) = 4 ??? Why sizeof(stACTIONS) is not 3 ? Engi -- For information on using the Palm Developer Forums, or to unsubscribe, please see

Re: GCC sizeof bug?

2002-10-13 Thread Michael Harrison
, 2002 at 05:43:38AM -0500, Michael Harrison wrote: TraceOutput( TL( appErrorClass, re-allocated %hu bytes of record memory, gNumRecordsAllocated * sizeof(UInt16) ) ); The sizeof operator returns a size_t, which, on Palm OS with both GCC and CodeWarrior, is the same size as a long. So your code

Re: GCC sizeof bug?

2002-10-09 Thread John Marshall
On Thu, Oct 03, 2002 at 05:43:38AM -0500, Michael Harrison wrote: TraceOutput( TL( appErrorClass, re-allocated %hu bytes of record memory, gNumRecordsAllocated * sizeof(UInt16) ) ); The sizeof operator returns a size_t, which, on Palm OS with both GCC and CodeWarrior, is the same size

struct size error(sizeof Error?)

2001-07-30 Thread J.J
Hi! I'm define my source below that int size; typedef struct test { chardata1[10]; chardata2[1]; }my_test; size = sizeof(my_test); I guess the value of size is 11 but, size value is 12 What's wrong??? I'm using CodeWarrior 7. Please Help

RE: struct size error(sizeof Error?)

2001-07-30 Thread Richard Anderson
:[EMAIL PROTECTED]] Sent: 30 July 2001 09:14 To: Palm Developer Forum Subject: struct size error(sizeof Error?) Hi! I'm define my source below that int size; typedef struct test { chardata1[10]; chardata2[1]; }my_test; size = sizeof(my_test); I

Re: struct size error(sizeof Error?)

2001-07-30 Thread Gavin Maxwell
It's called padding and it's added by the compiler to bring everything up to even byte boundaries... Cheers, Gavin. Hi! I'm define my source below that int size; typedef struct test { chardata1[10]; chardata2[1]; }my_test; size = sizeof(my_test); I guess

Re: sizeof(DateType) == 2 ?

2000-11-11 Thread Ricardo Contin
We will have a new year BUG ? in 2032 ?? For Palm and MAC ??? - Original Message - From: "Garth Watkins" [EMAIL PROTECTED] To: "Palm Developer Forum" [EMAIL PROTECTED] Sent: Sunday, November 05, 2000 1:27 PM Subject: Re: sizeof(DateType) == 2 ? This is beca

In the year 2032 (was: sizeof(DateType) == 2 ?)

2000-11-11 Thread Richard Burmeister
From: "Ricardo Contin" [EMAIL PROTECTED] Subject: Re: sizeof(DateType) == 2 ? We will have a new year BUG ? in 2032 ?? For Palm and MAC ??? IF you think either OS will exist in its current form in 2032, then the answer is yes :). (Of course, in the 60's nobody thought we'd still

RE: In the year 2032 (was: sizeof(DateType) == 2 ?)

2000-11-11 Thread Scott Johnson (Bellevue)
In 2032... Americans will still be arguing over who really won the 2000 election. :-) From: Richard Burmeister [mailto:[EMAIL PROTECTED]] IF you think either OS will exist in its current form in 2032, then the answer is yes :). (Of course, in the 60's nobody thought we'd still be running

sizeof(DateType) == 2 ?

2000-11-05 Thread Jamie Macleod
Can someone explain why sizeof(DateType) gives me 2? DateType is a structure declared as 3 UInt16 values, and of course if I do a (sizeof(UInt16) * 3) I get 6. Shouldn't I be getting 6 for DateType? Jamie -- For information on using the Palm Developer Forums, or to unsubscribe, please see

Re: sizeof(DateType) == 2 ?

2000-11-05 Thread Garth Watkins
To: "Palm Developer Forum" [EMAIL PROTECTED] Sent: Sunday, November 05, 2000 4:50 PM Subject: sizeof(DateType) == 2 ? Can someone explain why sizeof(DateType) gives me 2? DateType is a structure declared as 3 UInt16 values, and of course if I do a (sizeof(UInt16) * 3) I get 6. Shou

Re: sizeof(DateType) == 2 ?

2000-11-05 Thread Jamie Macleod
TED] wrote in message news:29167@palm-dev-forum... From: "Jamie Macleod" [EMAIL PROTECTED] Subject: sizeof(DateType) == 2 ? Can someone explain why sizeof(DateType) gives me 2? DateType is a structure declared as 3 UInt16 values, and of course if I do a (sizeof(UInt16) * 3) I

Re: sizeof(DateType) == 2 ?

2000-11-05 Thread Richard Burmeister
From: "Jamie Macleod" [EMAIL PROTECTED] Ahhh, thank you. I knew I was missing something obvious. Actually, I have a book, it's just not great on explaining structures. You wouldn't know it from my question, but I know C, I just haven't used it for 10 years, so I'm very rusty. No problem