4 ms·
Visual Studio will yell at you if your code isn't conforming to the "C++ Core Guidelines" (those guidelines basically define what "Modern C++" even means). Unf
by flohofwoe 3y ago
Visual Studio will yell at you if your code isn't conforming to the "C++ Core Guidelines" (those guidelines basically define what "Modern C++" even means).
Unfortunately it also yells at you when your *C* code violates the C++ Core Guidelines (at least it was a few years ago when I permamently switched that "feature" off).
- tialaramex 3y agoMany of the "Core Guidelines" are semantic requirements which are (provably) Undecidable, so even if tooling was created for them the tooling would necessarily have either false positives or false negatives (those are the only options, unless "both" counts as another option). In practice most of these are unaddressed, Microsoft understandably focused on checks which are never wrong and give actionable advice. "Guideline support" does include libraries with classes that e.g. provide a slice which raises an exception on bounds miss, which is something, and it's certainly notable that the equivalently named C++ standard library feature is a foot gun† whereas the one in the guideline support library is not, so that's a good reason to adopt this. But VS does not in fact ensure you obey all the guidelines, it's very much a "best effort" approach even with that switched on. † WG21 (The "C++ Standards Committee") seems to have concluded that because sometimes the fast way to do something is unsafe, therefore the unsafe way to do something must be faster... as if car executives noticed that 240mph crashes in their flagship sports car were often fatal and concluded that if they re-design their under-performing SUV so that the fuel tank explodes during any collision killing everybody aboard that'd improve its top speed...
- KMag 3y ago> tooling would necessarily have either false positives or false negatives (those are the only options, unless "both" counts as another option). Getting stuck in an infinite loop and never producing an answer is a 4th possibility for attempted solutions at deciding undecidable problems.
- tialaramex 3y agoGood point. Note that we can't necessarily tell it's an infinite loop, the constructive proof for this Undecidability reduces it to our old friend the Halting Problem, so we're in the land of the Busy Beaver.
- pjmlp 3y agoIt still does, given Microsoft's stance on security, and that C++ used to be the main systems language, hence why C support languished until pressure from relevant customers to pick it up. I say used to be, given the recent announcement of Azure business unit to switch to Rust as the favoured systems language for new engineering activities.
- account42 3y ago> C++ Core Guidelines" (those guidelines basically define what "Modern C++" even means) No, it defines what Microsoft C++ means and nothing more.