Assignment to pointers to functions returning void
Phil Karn
karn at allegra.UUCP
Sat Mar 3 15:18:23 AEST 1984
By wild coincidence, after hundreds of net.lang.c articles with esoteric
and/or uninteresting problems, I see two in a row that I've just
encountered.
I haven't gotten any compiler error messages when assigning the address
of a function which retuns null to a pointer of that type, but lint does
complain bitterly. Some lints (such as the System V) have this fixed.
I just put up with the noise. If you don't like that, a temporary fix
of the form
#define void int
will quiet things down until you get a fixed lint.
I too was looking for a clean way to declare a pointer to the end of a
structure within a structure, but I think you can get the effect you
want with a little simple pointer arithmetic and casting:
struct foo {
int retch;
int bletch;
};
struct foo *foop;
char *charp;
foop = (struct foo *)malloc(100);
charp = (char *)(foop + 1);
--Phil
More information about the Comp.lang.c
mailing list