How do I keep pointers aligned?
Jeffery Small
jeff at cjsa.WA.COM
Wed Oct 11 02:33:44 AEST 1989
henry at utzoo.uucp (Henry Spencer) writes:
>In article <12879 at s.ms.uky.edu> sean at 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
More information about the Comp.unix.wizards
mailing list