Xref: utzoo comp.unix.xenix:2663 comp.sources.d:2469 Path: utzoo!attcan!uunet!oddjob!ncar!ames!mailrus!tut.cis.ohio-state.edu!mandrill!hal!ncoast!allbery From: allbery@ncoast.UUCP (Brandon S. Allbery) Newsgroups: comp.unix.xenix,comp.sources.d Subject: Re: tgetent core dump on sco xenix Message-ID: <8236@ncoast.UUCP> Date: 12 Jul 88 00:14:21 GMT References: <54@libove.UUCP> <701@nod2sco> <3222@bigtex.uucp> Reply-To: allbery@ncoast.UUCP (Brandon S. Allbery) Followup-To: comp.unix.xenix Distribution: comp Organization: Cleveland Public Access UN*X, Cleveland, Oh Lines: 22 As quoted from <3222@bigtex.uucp> by james@bigtex.uucp (James Van Artsdalen): +--------------- | IN article <701@nod2sco>, rosso@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