Code Monkey home page Code Monkey logo

Comments (5)

eidheim avatar eidheim commented on August 23, 2024

Thank you for looking into this as well. I'm thinking we could just force #pragma once into new header files? It's 2018 anyway, and the important compilers have supported it for quite a while?

from jucipp.

szymonk211 avatar szymonk211 commented on August 23, 2024

I created header guards because I have some project with stupid guidelines that I didn't want to break. In case of my project you are right. Good habits and simplicity should be promoted, and nothing bad gonna happen if some unrelevant guidelines will be broken.
I just wonder if there are some projects, where (from legacy or some different reasons) it is really not possible to use #pragma once. Maybe for that reason it is good to left small window for code with header guards and just left the code in the way I wrote it (without some complex logic for discovering what kind of guards given project use).
What do you think?

from jucipp.

eidheim avatar eidheim commented on August 23, 2024

The only cases I can think of is when using really old compilers, or if one header file is split into several in a weird build setup. But I think it's safe to just add #pragma once if an empty header file is opened (for instance in Source::ClangViewParse::ClangViewParse(). It definitely will help a lot of new C++ programmers that tend to forget this (and get strange errors because of it). And in cases where it is not wanted, one can simply push undo or remove it manually.

from jucipp.

szymonk211 avatar szymonk211 commented on August 23, 2024

Good thinking. Thank you.

from jucipp.

eidheim avatar eidheim commented on August 23, 2024

I implemented my proposal in the commit above. I'm thinking it is better to have it than not:)

from jucipp.

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.