Giter VIP home page Giter VIP logo

Comments (3)

BigBahss avatar BigBahss commented on May 20, 2024

I kind of like this. Are you suggesting that this be sort of like a 'diagnostic' that would let you know when the list is not in order and prompt you to auto-fix it? If not, this could probably be done with a simple command, given that the user already knows it's out of order. Also, I've heard conflicting information on whether or not the order of initializers actually matter, so I would want to confirm that first.

from vscode-cmantic.

BigBahss avatar BigBahss commented on May 20, 2024

I just looked it up, the standard says the order doesn't matter, here's the snippet from cppreference:

Initialization order

The order of member initializers in the list is irrelevant: the actual order of initialization is as follows:

  1. If the constructor is for the most-derived class, virtual bases are initialized in the order in which they appear in depth-first left-to-right traversal of the base class declarations (left-to-right refers to the appearance in base-specifier lists)
  2. Then, direct bases are initialized in left-to-right order as they appear in this class's base-specifier list
  3. Then, non-static data member are initialized in order of declaration in the class definition.
  4. Finally, the body of the constructor is executed

(Note: if initialization order was controlled by the appearance in the member initializer lists of different constructors, then the destructor wouldn't be able to ensure that the order of destruction is the reverse of the order of construction)

Found here: https://en.cppreference.com/w/cpp/language/constructor

Since the order doesn't matter, this becomes more of a 'style' issue, which I'll leave up to the code formatters. Thank you for the submission though. I'm going to close this.

from vscode-cmantic.

Wastus avatar Wastus commented on May 20, 2024

Okay, that's fair enough. My idea was indeed that it would be a diagnostic (at best). But yes, it's for style.

from vscode-cmantic.

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.