Un-alignment in structures

Henry Spencer henry at utzoo.UUCP
Wed Mar 27 03:45:33 AEST 1985


>     ... unaligned struct foo *foop; {
> 
> Is foop a pointer to an unaligned struct foo, or is it an unaligned
> pointer to struct foo?  (The proposed "const" modifier has this
> problem, by the way.)

No it doesn't, and the problem could be solved for "unaligned" in the
same way.  Here's how it works for const:

	const char *pcc;		/* ptr to const char */
	char *const cpc;		/* const ptr to char */

It is agreed that the syntax is a bit ugly, but then C declaration
syntax has never been beautiful.

(None of this is to be taken to constitute an endorsement of "unaligned".
I tend to side with the people who think its contribution to portability
would be marginal, perhaps even negative [it deludes people into thinking
that their stuff is portable, when it's not].)
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry



More information about the Comp.lang.c mailing list