Xref: utzoo comp.lang.c:22629 comp.unix.wizards:18587 Newsgroups: comp.lang.c,comp.unix.wizards Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: How do I keep pointers aligned? Message-ID: <1989Oct10.021720.19815@utzoo.uucp> Organization: U of Toronto Zoology References: <12879@s.ms.uky.edu> Date: Tue, 10 Oct 89 02:17:20 GMT 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". -- A bit of tolerance is worth a | Henry Spencer at U of Toronto Zoology megabyte of flaming. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu