Path: utzoo!utgpu!attcan!uunet!husc6!cmcl2!rutgers!mcnc!rti!xyzzy!meissner From: meissner@xyzzy.UUCP (Usenet Administration) Newsgroups: comp.lang.c Subject: Re: lint warning messages with malloc() Message-ID: <1715@xyzzy.UUCP> Date: 7 Nov 88 01:12:19 GMT References: <142@cjsa.WA.COM> <355@marob.MASA.COM> Reply-To: meissner@xyzzy.UUCP (Michael Meissner) Organization: Data General (Languages @ Research Triangle Park, NC.) Lines: 17 In article <355@marob.MASA.COM> daveh@marob.masa.com (Dave Hammond) writes: /* stuff about lint giving errors calling malloc deleted */ | The program code is not at fault. The problem is that lint does not | know about malloc returning a suitably aligned pointer, therefore | it complains. You could do some fancy declaration footwork and declare | | X *malloc(); No, No, No, No, No, No! There are implementations of C on word-based machines, which use different representations for different types of pointers. Since the library routine malloc returns a char *, and you have declared to return X *, you will get undefined behvior. This is NOT guaranteed by K&R, H&S, or X3J11. -- Michael Meissner, Data General. Uucp: ...!mcnc!rti!xyzzy!meissner Arpa: meissner@dg-rtp.DG.COM (or) meissner%dg-rtp.DG.COM@relay.cs.net