Difference between revisions of "Talk:TUT:Simple Async Application"

From Net-SNMP Wiki
Jump to: navigation, search
 
 
Line 16: Line 16:
  
 
The name of the structure and the type of the second field have the same names. Is it possible??
 
The name of the structure and the type of the second field have the same names. Is it possible??
 +
 +
:Nope...  That's legal C because the structure, when used, would need to be prefixed with "struct" to work.  It couldn't be a typedef, however, because in fact 'oid' is already a typedef.

Latest revision as of 14:56, 1 March 2010

Is it bug??

/*
  * a list of variables to query for
  */
 struct oid {
   char *Name;
   oid Oid[MAX_OID_LEN];
   int OidLen;
 } oids[] = {
   { "system.sysDescr.0" },
   { "interfaces.ifNumber.1" },
   { "interfaces.ifNumber.0" },
   { NULL }
 };

The name of the structure and the type of the second field have the same names. Is it possible??

Nope... That's legal C because the structure, when used, would need to be prefixed with "struct" to work. It couldn't be a typedef, however, because in fact 'oid' is already a typedef.