This isn't an issue. It is the proper behaviour for sizeof. It gives the
total size of the structure (including padding).
I'm not really too sure what you're trying to do here. There are no
structure pointers, only typedefs. We can't see how you are intending on
using them at all.
I'm not really too sure how you are intending on using sizeof either - but
there are always alternatives.

Laurence Mee.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Phong
Nguyen
Sent: 26 January 2002 03:13
To: Palm Developer Forum
Subject: Re: Code Warrior Compiler bug?


Thanks for the answers so far but if there is no
solution for this issue, it would really be a SERIOUS
problem for me and also for everyone out there when
using the built-in function sizeof(..) !!!!!!! What
can I do if I want to define several structure types
defined a structure of a message and try to decode it
using the structure pointers as follows:

typedef struct
{
    char preamble[2];
    char command;
}
HeaderType;

typedef struct
{
    char checksum[2];
    char terminator;
}
TrailerType;

typedef struct
{
    HeaderType  header;
    char        data[10];
    TrailerType trailer;
}
MessageType;

Any solution? Thanks.

--- Joe <[EMAIL PROTECTED]> wrote:
>
> I wrote:
> > >The processors currently used by Palm OS devices
> do not allow
> > >addressing of odd-numbered bytes,
>
> --- Keith Rollin wrote:
> > Sure they do!  How else would it access name[1]?
>
> Of course, Keith is right.  What I meant is that
> variables must be
> aligned on an even boundry.  Naturally, you can
> access every byte after
> that, but variables must be word-aligned.  The
> compiler will,
> therefore, "waste space" by padding structures to
> ensure that each
> variable starts at an even address.  Hopefully that
> was clear to anyone
> who read my entire post.  I'll just have to choose
> my words more
> carefully next time!
>
>
> __________________________________________________
> Do You Yahoo!?
> Great stuff seeking new owners in Yahoo! Auctions!
> http://auctions.yahoo.com
>
> --
> For information on using the Palm Developer Forums,
> or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/


__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions!
http://auctions.yahoo.com

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


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

Reply via email to