This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: The treatment of null characters in C source files


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]