Charles Rezsonya <[EMAIL PROTECTED]> wrote:
> #define    sizeof    (Int)sizeof
> 
> what this does is cast the sizeof to an int then that is passed as any
> parameter you use it in.  it seems kinda strange that this should be done.
> anyone have any ideas on the reasoning why this method accomplishes what
> sizeof is supposed to do in the first place?

size_t, which is the type returned by sizeof(), is defined in Standard C
to be an "unsigned integral type".  In particular its actual size is not
specified.  On Palm OS it is probably long, which is different from Int.

>> when i call the same function from another file (not common or starter),
>> i pass the sizeof (struct) as the 3rd param and it passes 0.

Believe it or not, you are having a similar problem to the "StrPrintF
Bug?" thread.  Without a prototype, the compiler has no opportunity to
convert the arguments you give to the types expected by the parameters
of the function you're calling.  The onus is then on you to get it right.
When you pass long to something expecting int, you're not getting it right.

Life really is easier when you ensure that there's a prototype in a header
file for every extern function you call.  There's a reason why prototypes
were added to the language...  :-)

    John

-- 
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