Dumb question on dyn. mem. alloc (if(hate(novices)) dont_read();)

Guy Harris guy at sun.uucp
Mon Jul 22 07:50:04 AEST 1985


> Lint doesn't realize that malloc and calloc have been written such
> that that "possible pointer alignment problem" never occurs.  The
> thing to do is ignore the message (or teach lint how to say that
> a function returns a ``very aligned'' pointer; someone once suggested
> using /*ALIGNOK*/ similar to the way /*NOTREACHED*/ and /*ARGSUSED*/
> tell lint not to complain).

Hopefully, pointers of the ANSI C type "void *" will be able to be assigned
to any other pointer type without any complaints, including complaints about
possible alignment problems.  This is, of course, a horribly large loophole,
but there may be some small hope that people won't abuse it and will always
write routines like "malloc" which return "void *" values to align the
object pointed to so that it can, indeed, be used to point to anything.

	Guy Harris



More information about the Comp.lang.c mailing list