query related to semantic behaviourial comparision in C thru gcc

Eljay Love-Jensen eljay@adobe.com
Wed Mar 10 20:30:00 GMT 2004


Hi Silver,

void printSymtab(void)
{
   Symtab *tptr;
   Symtab t;


   puts("**************\n\t\tSymTable**************");
   puts("    Name              PIB    PIH    BlkNo ");

   printf("%u", t);      	<-------------ALLOWED
// t gets passed in by address.  Even though you are using that address
// as a "%u" ... which isn't going to be pretty.

   if (t) ;			<-------------NOT ALLOWED (line 84)
// Assuming Symtab is a struct, you are using a struct as an expression.

   if (tptr);			<-------------This is OKAY
// Testing a pointer as being non-null is okay.  Style-wars aside.

   if (*tptr);			<---------NOT ALLOWED/possibly it is error
								(line 88)	
// Assuming Symtab is a struct, you are using a struct as an expression.

   return;
}

HTH,
--Eljay



More information about the Gcc-help mailing list