Mark Wilden wrote:
> Actually, that part of the code is valid:
> 
>  char *sdf;
>  sdf = "ABC";
> 
> Four bytes of constant data have been allocated for "ABC", and sdf is set to
> point at that data. If sdf isn't going to change, then
> 
>  char sdf[] = "ABC";
> 
> is equivalent, and saves the space for the pointer.

Do you really gain anything?  In the first case, ignoring alignment
requirements, you consume sizeof (char*) bytes on the stack and four bytes from
wherever-it-is-string-literals-go.

In the second case, you consume four bytes on the stack and four bytes from
wherever-it-is-the-array-initializer-gets-stored.

The second case also requires more instructions to initialize the sdf (although
the first requires some for dereferencing...)

Right?

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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

Reply via email to