This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: The treatment of null characters in C source files
- To: law at cygnus dot com
- Subject: Re: The treatment of null characters in C source files
- From: craig at jcb-sc dot com
- Date: 6 Sep 1999 00:41:51 -0000
- cc: zack at bitmover dot com, gcc at gcc dot gnu dot org
- cc: craig at jcb-sc dot com
- References: <17720.936576369@upchuck.cygnus.com>
> > The question is, is this an acceptable behavior change for the
> > compiler? Making cpplib pass through nulls would be extremely
> > difficult, but someone might have a legitimate use for them.
>No, I do not believe that is acceptable behavior.
>
>It is perfectly legitimate for a string to have a null character in it. If
>you look hard you'll even find examples of this in gcc itself.
A C *string* (as a constant) may certainly have a null character in it,
as in "hello\000 there".
But, surely there's no requirement that a C *source file* be allowed to
have a null character in it.
Since, when printed or displayed in various canonical ways, a C source
file containing a NUL will look exactly like one without that NUL,
but can (apparently) behave differently, I recommend the warning
be preserved.
Programmers can always write \000 where they want NUL in a string, right?
And that prints/displays correctly pretty much all the time.
tq vm, (burley)