Menu

typedef enum check question

2016-09-07
2016-09-13
  • francisco astorga

    Is there a way add a check that variables defined with typedef enum are assigned the typedef constants in C files. C++ does this but there is not such check under C (it is allowed). C++ is not (and never will be) an option for me.

     
  • Daniel Marjamäki

    As far as I understand you would like something like:

    enum ABC {A,B,C} abc;
    abc = D;  // <- warn about this
    

    I tried to add such check a while ago (enumMismatch). But unfortunately it turned out it generated too much noise and we removed it.

    Reimplementing it as an addon would be possible. If somebody does that I would be happy to add it.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.