"Richard Burmeister" <[EMAIL PROTECTED]> wrote in message
news:41361@palm-dev-forum...
>
> > From: HowY
> >
> >  Char mantissaStr[10]="\0\0\0\0\0\0\0\0\0\0";
> >  Char dispMantissaStr[10]="\0\0\0\0\0\0\0\0\0\0";
> >
>
> HowY,
>
> I don't know about GCC, but with CW the above statements are not correct.
> You allocate 10 bytes for each string, then assign 21 bytes to each.  '\0'
> is the char which == 0.  "\0" is an array of 3 chars, '\', '0', and '\0'.

Huh?  CW honors the \0 escape for both character literals and strings.  I
should know -- I rewrote a lot of that escape parsing code.  You might be
confused by the debugger display.  When the CW debugger shows a string, it
will show it in escaped C string format, although if its showing a C string,
then I'd guess it would cut it off at the first NUL character.

The problem here is actually that the user is specifying a string of 11
characters -- even with the escaped NULs, there still is the terminating
NUL.  And, as Aaron pointed out, if you specify a partial array in C, the
compiler is obligated to zero-fill.

--
Ben Combee
Veriprise Wireless <http://www.veriprise.com>



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