lint warning messages with malloc()

Dave Hammond daveh at marob.MASA.COM
Mon Nov 7 23:21:05 AEST 1988


In article <1169 at microsoft.UUCP> tonyw at microsoft.UUCP (Tony Williams) writes:
>In article <355 at marob.MASA.COM> daveh at marob.masa.com (Dave Hammond) writes:
>|               You could do some fancy declaration footwork and declare
>|
>|X *malloc();
>
>DO NOT DO THIS.  Since you are using lint, I assume you care somewhat
>about portability :-).  There are machines out there for which
>struct X * and char * have different representations.
>On these machines, malloc will return the char* representation and you
>must have the cast to convert it.

Sorry!  My example should have shown conditional inclusion for lint only, e.g.:

#ifdef lint
X *malloc();
#else
char *malloc();
#endif

Dave Hammond
  UUCP: ...!uunet!masa.com!{marob,dsix2}!daveh
DOMAIN: daveh at marob.masa.com
----------------------------------------------------------------------------



More information about the Comp.lang.c mailing list