Coder Social home page Coder Social logo

reserved identifier violation about openage HOT 4 CLOSED

sfttech avatar sfttech commented on April 27, 2024
reserved identifier violation

from openage.

Comments (4)

mic-e avatar mic-e commented on April 27, 2024

Hm... from various other C projects I've looked at/worked on, I was under the impression that this is how header guards are done, but you're of course right in that we should follow the standard. Standards are a great thing. I suggest we change the guards to CALLBACKS_H and ENGINE_TERRAIN_H as suggested in your link.

from openage.

mdparker avatar mdparker commented on April 27, 2024

Since the project is using C++ 11, there's no reason not to simply use "#pragma once" at the top of each header. All modern C++ compilers support, AFAIK.

from openage.

mic-e avatar mic-e commented on April 27, 2024

We've been considerating that... there are benefits, especially that classical guards are very prone to accidential name clashes or typos.
It's obviously useful, so I researched why it wasn't put into the standard. The answer seems to be that header files might be copy/pasted or reached over multiple paths through symlinks, confusing the compiler as to whether to include them with #pragma once.
I'm rather undecided right now... obviously the C++ standards commitee knows what they're doing*, so if they decide against #pragma once, maybe we should just accept that. Ideally, there would be something like #pragma once ENGINE_TERRAIN_H.

*disclaimer: actually they don't

P.S.: obligatory stackoverflow link

from openage.

mic-e avatar mic-e commented on April 27, 2024

Fixed by pull request #18

from openage.

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.