negative addresses
T. William Wells
bill at proxftl.UUCP
Sat May 28 07:09:26 AEST 1988
In article <4086 at gryphon.CTS.COM>, sarima at gryphon.CTS.COM (Stan Friesen) writes:
) There *are* cases of code that does make such assumptions.
) They all have the following general form:
)
) func1(p)
) char *p;
) {
) /* stuff */
) }
)
) ...
)
) func2()
) {
) ...
) func1(0);
) }
)
) In this example the code assumes both the representation *and* the
) size of NULL-pointer. This code is *not* portable even among existing
) compilers. Nor is it even conforming, let alone strictly so. Any code of
) this form only works accidentally and needs to be fixed anyway.
) --
) Sarima Cardolandion sarima at gryphon.CTS.COM
) aka Stanley Friesen rutgers!marque!gryphon!sarima
Actually, if you are using Standard C, declare func1 with a prototype
and the problem goes away. Prototypes were invented to (among other
things) solve this kind of problem.
Perhaps this is what you intended to say?
More information about the Comp.lang.c
mailing list