Help me cast this!: Ultrix 2.x bug
Chris Torek
chris at mimsy.UUCP
Wed May 4 15:20:17 AEST 1988
context:
struct outfile (*output)[] = <<cast>>malloc(sizeof(struct outfile) * 3);
---what to use for <<cast>>:
In article <1451 at iscuva.ISCS.COM> carlp at iscuva.ISCS.COM (Carl Paukstis) writes:
> output = (struct outfile **)malloc(sizeof(struct outfile) * 3);
>
>works on Ultrix 2.something ....
... but only because of a compiler bug. Obviously DEC have
not installed Guy Harris's fixes to chkpun() in mip/trees.c.
[lint complains]
>"possible pointer alignment problem" ...
4.3BSD `man lint':
BUGS
There are some things you just can't get lint to shut up
about.
This is one of them. malloc() returns a maximally-aligned pointer, but
lint does not know, and cannot be told. (There may be smarter lints
that can be told; ours can also be improved. Meanwhile, I tend to run
all lint output through `grep -v "possible pointer alignment problem"'.)
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain: chris at mimsy.umd.edu Path: uunet!mimsy!chris
More information about the Comp.lang.c
mailing list