Interpretation question: Pointers to explicitly zero-length strings

Doug Gwyn gwyn at smoke.BRL.MIL
Tue Jul 11 10:18:49 AEST 1989


In article <65745 at yale-celray.yale.UUCP> leichter at CS.YALE.EDU (Jerry Leichter) writes:
>If the maximum length given is zero, must the pointer passed be valid?

Yes, unless the case of a null pointer is explicitly given special
semantics, any pointer described as pointing to a string must in
fact point to a valid string.  The implementation is entitled to
access the first byte pointed to, even if it might not be logically
necessary in order to determine the result in the 0-length case.

Disclaimer: Not an official X3J11 statement.



More information about the Comp.std.c mailing list