hercules-390 / hyperion

Hercules 390
Other
252 stars 68 forks source link

enums not defined in telnet.h #152

Closed PeterCoghlan closed 8 years ago

PeterCoghlan commented 8 years ago

I get the warnings below when compiling anything that includes telnet.h (which is probably nearly everything) on my VMS system. The warnings go away if I move the enums for telnet_event_code_t (starting at line 288) and for telnet_error_t (starting at line 307) so that they are before the block of typedefs.

typedef enum telnet_event_code_t telnet_event_code_t; ........^ %CC-W-UNDEFENUM, In this declaration, the enum "telnet_event_code_t" is not defined at line number 123 in file telnet.h

typedef enum telnet_error_t telnet_error_t; ........^ %CC-W-UNDEFENUM, In this declaration, the enum "telnet_error_t" is not defined at line number 124 in telnet.h

Fish-Git commented 8 years ago

Your compiler is weird, Peter.  :)

It doesn't complain about forward declared struct or union typedefs, but it complains about forward declared enum typedefs? Seems awfully silly to me!

Ah well. Other compilers don't seem to care whether the enum declarations come before or after the typedefs so I guess it won't hurt to move them up so your compiler doesn't complain.  :)

jphartmann commented 8 years ago

You are aware that you can combine the typedef and enum into one declaration? This is already done for some structs.

For example,

typedef 
enum anenum
{
   item,
   another,
} anenum_t;
Fish-Git commented 8 years ago

Of course! But there's no reason why they can't be defined separately either (except that at least one known compiler happens to complain about that of course).

PeterCoghlan commented 8 years ago

Thanks Fish - the warnings are gone away now.