AW: [cedet-semantic] Typedef for enums
Brought to you by:
zappo
From: Jans, H. <hau...@se...> - 2005-02-03 10:04:50
|
Hi Klaus. =20 The advantage is that you can use the type QF in prototypes and let the compiler check the type validity for actual parameters. =20 So you could write the following prototypes: =20 setQF(QF qf); =20 and if you call i.e. setQF(QF_OK) that compiles ok, but if you use setQF(0) you get a compiler warning / error. =20 This is common practice and i think it should work within semantic also. =20 Regards. =20 Hauke =20 ________________________________ Von: kla...@sd... [mailto:kla...@sd...] Gesendet: Do 03.02.2005 10:25 An: Jans, Hauke; ced...@li... Betreff: AW: [cedet-semantic] Typedef for enums Hi, >I would expect that i see 4 consts after parsing via semantic. But i = only see the tag for QF >but not for QF_UNDEFINED etc. >typedef enum >{ > QF_UNDEFINED, > QF_EVALUATION_IN_PROGRESS, > QF_UNUSED, > QF_OK >} QF; If you write: enum QF { QF_UNDEFINED, QF_EVALUATION_IN_PROGRESS, QF_UNUSED, QF_OK }; you will see (in ECB for example): [-] QF:enum `- [-] [Attributes] | QF_UNDEFINED:int | QF_EVALUATION_IN_PROGRESS:int | QF_UNUSED:int `- QF_OK:int which is what you want - at least i assume ;-) Question: What is the advantage when you use your typedef-notation compared to mine?? BTW: If yours is correct c++/c-code and also in common use then the semantic-parser should parse it - of course... Ciao, Klaus Regards Hauke |