Menu

ctuOneDefinitionRuleViolation false positive with ifdef

2021-09-09
2021-09-10
  • Steve Albright

    Steve Albright - 2021-09-09

    When using ifdefs to manage "similar" classes this is a false positive

    error: ctuOneDefinitionRuleViolation - The one definition rule is violated, different classes/structs have the same name 'DupeSymbolExample'

    #ifdef NOT_REALLY_DEFINED
    
    class DupeSymbolExample
    {
    public:
       DupeSymbolExample() {}
    
       void DifferentFunction()
       {
       }
    };
    
    #else
    
    class DupeSymbolExample
    {
    public:
       DupeSymbolExample() {}
    
       void OtherDifferentFunction()
       {
       }
    };
    
    #endif
    
     
  • CHR

    CHR - 2021-09-09

    Sounds similar to this ticket: https://trac.cppcheck.net/ticket/10431

     
  • Steve Albright

    Steve Albright - 2021-09-09

    Agreed, can someone reset my password on trac?

     
    • Daniel Marjamäki

      ok I can do it.. can you send me a new htpasswd hash somehow?

       

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.