Xref: utzoo comp.lang.c:22670 comp.unix.wizards:18609 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!rutgers!mit-eddie!uw-beaver!sumax!thebes!quick!cjsa!jeff From: jeff@cjsa.WA.COM (Jeffery Small) Newsgroups: comp.lang.c,comp.unix.wizards Subject: Re: How do I keep pointers aligned? Message-ID: <1965@cjsa.WA.COM> Date: 10 Oct 89 16:33:44 GMT References: <12879@s.ms.uky.edu> <1989Oct10.021720.19815@utzoo.uucp> Organization: C. Jeffery Small and Associates - Woodinville, WA Lines: 20 henry@utzoo.uucp (Henry Spencer) writes: >In article <12879@s.ms.uky.edu> sean@ms.uky.edu (Sean Casey) writes: >>Lint tells me I have possible pointer alignment problems. >>s = (STUFF *) malloc((unsigned) sizeof(STUFF)); >The problem is that lint has no way of knowing that the `char *' returned >by malloc is sufficiently well-aligned for use as a `STUFF *'. In fact, >it is -- that's part of the specs of malloc -- but lint doesn't know that. >In practice, "possible pointer alignment problem" just means "better look >twice to make sure this is right". It doesn't mean "this is wrong". Something I have often wondered: Is there a good reason why lint hasn't been modified to understand the "specs" of malloc and eliminate these unnecessary warnings? Does building such knowledge into lint violate its design philosophy? -- Jeffery Small (206) 485-5596 uw-beaver!uw-nsr!uw-warp C. Jeffery Small and Associates !cjsa!jeff 19112 152nd Ave NE - Woodinville, WA 98072 uunet!nwnexus