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

Henry Spencer henry at utzoo.UUCP
Sat Jul 20 01:58:27 AEST 1985


> ...  It seems that no
> matter how I declare the function calloc() or how I typecast in
> the returned pointer, I get a warning from lint that I have
> a "possible pointer alignment problem." ...  what problems
> am I going to run into and how can I fix them (or should I just 
> ignore the the message)?

Ignore the messages.  Lint is saying "you are casting one kind of pointer
to another, and this is an area where portability problems can occur";
it doesn't know that malloc() and friends are a special case where this
sort of thing is guaranteed to be safe.  This particular message is
enough of a pain that the "lint" entry in the Makefile for any program
of mine that uses malloc() a lot tends to read something like:

	lint foo bar bletch | egrep -v 'possible pointer alignment'

One should do this sort of thing with fear and trepidation, but it is
unfortunately true that *real* lint problems are much easier to spot when
they aren't buried in a river of meaningless complaints about malloc().
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry



More information about the Comp.lang.c mailing list