Giter VIP home page Giter VIP logo

Comments (4)

haveTryTwo avatar haveTryTwo commented on September 4, 2024

Thanks for your advise!
The "Noncompliant Code Example" : #define _MY_HEADER_H_ , and the reason why it's noncompliant is "The name may clash with reserved names defined by the implementation of the C++ standard template library in its headers or with reserved names implicitly predefined by the compiler even when no C++ standard library header is included"; and the macro defined in C++ standard template library may be like #ifndef _GLIBCXX_ISTREAM that begins with an underscore, so avoiding using leading or trailing underscores in the name of the header guard may be compliant solution.
But this may be not only one compliant solution! The 'Google C++ Style Guide' advise the symbol name should be : #define PROJECT_PATH_FILE_H_ . I think if it can achieve the purpose that not clash with reserved names defined by the C++ standard template, the macro that begins and ends with double underscore may be also ok.
Do you think so?

from qconf.

elfring avatar elfring commented on September 4, 2024

It is popular to use a suffix like "_H" for include guards. - There are better ways to make your identifiers reasonably unique.

Would you like to avoid that your software depends on undefined behaviour?

from qconf.

haveTryTwo avatar haveTryTwo commented on September 4, 2024

To make our identifiers unique, we'll take your advice, thanks again!

from qconf.

elfring avatar elfring commented on September 4, 2024

Thanks for your improvement of affected include guards.

from qconf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.