ANSI C standard library

Henry Spencer henry at zoo.toronto.edu
Thu May 2 03:07:50 AEST 1991


In article <114913 at tut.cis.ohio-state.edu> meranda at iguana.cis.ohio-state.edu (deron meranda) writes:
>For example, consider the function strchr (section 4.11.5.2).  Clearly
>if it were implemented entirely in C, it has to produce a plain char *
>from a const char *.  Although most compilers will allow this with a
>warning, it is not strictly-conforming C.

Uh, where did you get that idea?  Please cite chapter and verse.  Some
earlier drafts of ANSI C restricted pointer conversions so that this sort
of conversion was not strictly conforming; the result was loud protests
and the problem was fixed.

It is true that you have to beware of alignment in such conversions, but
that is not an issue here.  It is also true that if you use such a converted
pointer to attempt to modify a "const char" variable, all bets are off.  But
the conversion itself is strictly conforming.
-- 
And the bean-counter replied,           | Henry Spencer @ U of Toronto Zoology
"beans are more important".             |  henry at zoo.toronto.edu  utzoo!henry



More information about the Comp.std.c mailing list