Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!wums2!tan_j From: tan_j@wums2.wustl.edu Newsgroups: comp.sys.sgi Subject: Re: Another C compiler bug Message-ID: <3734.26a442ed@wums2.wustl.edu> Date: 18 Jul 90 16:07:24 GMT Lines: 28 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@wums.wustl.edu