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
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
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
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
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
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
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
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/
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
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
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
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
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
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
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
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
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
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
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
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/
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
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
, 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
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
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
:[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
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
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
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
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
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
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
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
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
34 matches
Mail list logo