5 ms·
Title: > a tour through modern C++ Then: ``` #ifndef JSON_H #define JSON_H // ... #endif ``` Still I didn't get how #pragma once didn't end up in a stan
by trzeci 5y ago
Title:
> a tour through modern C++
Then:
```
#ifndef JSON_H
#define JSON_H
// ...
#endif
```
Still I didn't get how #pragma once didn't end up in a standard, when every major compiler supports that.
- kitkat_new 5y agoI thought modules would be modern C++ now? Am I missing something?
- eatonphil 5y agoI tried but couldn't get modules working, personally. The various sites online I found differed in how they work in the first place. I couldn't find what the actual state of modules are in Clang.
- pjmlp 5y agoHere, https://blog.ecosta.dev/en/tech/cpp-modules-with-clang https://blog.ecosta.dev/en/tech/cpp-modules-with-clang
- DeathMetal3000 5y agoThat lengthy blog post is a perfect example of everything that is wrong with C++. Using modules should be a trivial part of the language. Instead, we have to take a detour via historical Objective-C (a language already superseded) and there are enough caveats to make a lawyer blush.
- pjmlp 5y agoSome languages care to keep 30 years of code compiling, regardless of the new shinny features.
- int_19h 5y agoIt's so modern (C++20), it's not actually implemented fully by all compilers yet. https://en.cppreference.com/w/cpp/compiler_support#cpp20 https://en.cppreference.com/w/cpp/compiler_support#cpp20
- pjmlp 5y agoIt is already good enough on Visual C++. Such is the price for an ISO language with multiple implementations.
- initplus 5y agoI feel more and more like Microsoft/Apple/GNU need to do what Apple/Mozilla/Google/Microsoft did when they turned their backs on the w3c and formed WHATWG. If the standard committee can't even agree on concepts like the existence of a filesystem, we need a different committee.
- shipp02 5y agoThe standards committee have too broad of a scope and think they can make everyone happy. They want the same C++ to work on embedded and cloud servers while not making anyone update any of their old code and having full backwards compatiblility. This results in tradeoffs that make everyone unhappy.
- pjmlp 5y agoWe all know what happens when backwards compatibility gets broken. Plus there are several options already when backwards compatibility isn't relevant.
- pjmlp 5y agoWho do you think calls most shots at ISO meetings?
- gkbrk 5y ago> do what Apple/Mozilla/Microsoft did when they turned their backs on the w3c and formed WHATWG You mean when they gave Google the power to add whatever they want to the standards and get the hate of web developers for "being the new IE" whenever they refuse to implement Google's API of the day? Not sure I'd want that infinitely growing scope for compilers I use for production systems.
- pjmlp 5y agoSame can be said about ISO C and several common C extensions.
- ojeda 5y agoFor C, there is a paper (pending publication) about this. No promises, of course, but the committee will at least have a look.
- secondcoming 5y agoAll our code uses #pragma once instead of the old way. Zero issues.
- trzeci 5y agoSame here and our games run on every possible device with a screen.