lint warning messages with malloc()
Gordon Cross
crossgl at ingr.UUCP
Fri Nov 4 00:02:19 AEST 1988
In article <142 at cjsa.WA.COM>, jeff at cjsa.WA.COM (Jeffery Small) writes:
> When compiling a program on an AT&T 3B1 (running SystemV.2 +/-), I am
> getting the following warning message from lint when I use malloc(3):
>
> warning: possible pointer alignment problem
The warning that lint is giving you is based on the fact that you are casting
a character pointer (returned from malloc) into another pointer type having
more stringent alignment requirements. Malloc does guarantee that all
pointers it returns are properly aligned to use with any data type but lint
does not assume this since "malloc" is just another function (you could write
your own version you know). Your best bet is to just ignore the warning
since you are NOT in reality going to have any problems from this!
Gordon Cross
Intergraph Corp. Huntsville, AL
More information about the Comp.lang.c
mailing list