R
Richard Bos
Keith Thompson said:I suppose it's undefined behavior in the sense that the standard
doesn't guarantee that it will work. On the other hand, an
implementation could choose to guarantee a larger number of
characters, or it could state that there are no fixed limits, only
those imposed by resource constraints.
So they could, but that doesn't make it any less undefined by the
Standard. An implementation can choose to define, for itself only, _any_
case of undefined behaviour. If an implementation wants to define that
passing a null pointer to strlen() returns 0, that's fine. Doesn't make
passing null pointers to strlen() any more defined, though - except for
that implementation. The same is true in this case.
Richard