retiring gets(3)

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Nov 18 12:35:38 AEST 1988


In article <4509 at aldebaran.UUCP> jimp at cognos.UUCP (Jim Patterson) writes:
>Requiring that the "null pointer constant" be 0, as ANSI C does, just
>makes any other implementation painfully difficult (and is begging for
>problems when porting software as well).

Please get your facts straight before complaining.  C has always
allowed a null pointer constant to be written as 0.  ANSI C merely
makes (void*)0 a valid alternative way to write a null pointer
constant.  (K&R C didn't have void*.)

The contexts where a null pointer constant are being used aren't
all that hard for a compiler to determine, and it can generate
whatever code is necessary for such cases.  By no means is an
all-0-bit representation forced on the implementation.

>It's worth noting that pre-clearing memory shouldn't be considered
>wasted overhead on the part of the OS. It's an important security
>precaution, to prevent other system users from poking through memory
>that used to belong to someone else and which could contain sensitive
>information. This may not be important to all users, but it is to
>many.

All the UNIX implementations I know of arrange for extended program
break memory (heap) and stack to be zeroed.  It would be even safer
to zero it just before relinquishing process ownership of it.



More information about the Comp.lang.c mailing list