Another C compiler bug
tan_j at wums2.wustl.edu
tan_j at wums2.wustl.edu
Thu Jul 19 02:07:24 AEST 1990
Alright, this is actually in addition to my comments about the C code.
I was saying that it is easily it is easy to forget the initialization
of pointer, and I prove it myself. I forgot to indicate that the
ap->slot itself must be initialized. Therefore, add something like,
int a;
ap->slot = (void *)&a;
somewhere along the line is a must.
Another flaw that I did not see is
the register declaration. register storage class only takes word size
variable. So, the declaration
register struct anystruct *pointer_variable;
is OK because pointer is essentially a word-size variable. But
register struct anystruct plain_variable;
is a piece of bad code ! If anystruct is declared as
struct anystruct {
int a;
char b[50];
void *c;
};
Then it is obvious that a register cannot hold all variables declared in
the structure. Although in your case, you declared a struct with only
a void pointer member. I don't really know the answer. I guess it
depends on the compiler ? Comments welcome.
"Never do it on early morning"
tan_j at wums.wustl.edu
More information about the Comp.sys.sgi
mailing list