tgetent core dump on sco xenix

Brandon S. Allbery allbery at ncoast.UUCP
Tue Jul 12 10:14:21 AEST 1988


As quoted from <3222 at bigtex.uucp> by james at bigtex.uucp (James Van Artsdalen):
+---------------
| IN article <701 at nod2sco>, rosso at sco.COM (Ross Oliver) wrote:
| > Here are a few tips to avoid problems like this in large-model
| > 286 programs:
| 
| >     - Declare your functions' return values.
| >     - Don't use "0" to mean NULL ( i.e. (char *)0 ).
| 
| C requires that the integer constant 0 be assignable to *any* pointer
| type.  C also requires that any pointer type may be compared with the
| integer constant 0.  If the Xenix compiler requires that the integer
| constant 0 be cast to a pointer type first, it is broken.
+---------------

Only true in all cases IF (1) your compiler supports ANSI prototypes and (2)
you use them.  Otherwise, passing untyped 0 to a function expecting a pointer
fails for the same reason that the getenv() in the original code did:  the
compiler can't figure out what type is needed there, so it uses (int).
-- 
Brandon S. Allbery, uunet!marque!ncoast!allbery			DELPHI: ALLBERY
	    For comp.sources.misc send mail to ncoast!sources-misc



More information about the Comp.unix.xenix mailing list