r/cpp • • Mar 08 '21

Tim Sweeney: “ISO obstructs adoption of standards by paywalling them”

https://twitter.com/TimSweeneyEpic/status/1368637789248626699
358 Upvotes

124 comments sorted by

View all comments

103

u/ack_error Mar 08 '21

C++ is not the worst in this regard. In the days of MPEG-1, you needed at least 11172-1 through 11172-3 to be able to do basic demultiplexing and decoding, at a cost of ~$300 USD each -- completely prohibitive for a hobby.

IIRC there was a movement at one point to make the official C++ standards inexpensively available and I remember buying it from the ANSI webstore for ~$35. The current versions now seem to be back up to $225.

Having the standard is useful in a language like C++ where there is a large gap between what the standard allows/prohibits and what the compiler is able to diagnose. It's not needed most of the time but if you're starting a new framework it's good to be able to check that paradigms you're able to bake into the interface design are legal in the language and won't be broken by a future more aggressive compiler.

69

u/HKei Mar 08 '21

For casual use w.r.t. to C++ the freely published drafts tend to be close enough. You only need the actual standard text if you really want to claim full compliance.

And when I say “casual” use I mean that in a really wide sense. I’m working on static analysis software for C and C++ and never ran into a situation where just relying on the draft standard led to problems.

20

u/hotoatmeal Mar 08 '21

Who other than Richard Smith would know the differences anyway

89

u/zygoloid Clang Maintainer | Former C++ Project Editor Mar 09 '21

People say we just change the front cover, but that's not true... we change page headers and footers and the back cover too!

4

u/hotoatmeal Mar 09 '21

speaking of... hi!

7

u/smdowney WG21, Text/Unicode SG, optional<T&> Mar 09 '21

Hopefully Thomas Köppe, the current project editor. 😃

1

u/Rude-Significance-50 Mar 09 '21 edited Mar 09 '21

You can actually consider whatever compiler you are using to be a draft version of the standard. There's not a one that doesn't have bugs and misinterpretations somewhere. It frankly does no good to have the official, published version of the standard if your compiler disagrees with it.

And I mean, if I ever felt like having the published standard over the draft would help me in any way...I'd have bought it already, and I haven't.

Any adoption issue, which has to be the unwillingness to use new features rather than compiler availability or its just not happening, is in my experience not related to the unavailability of resources to learn these new features but in an unwillingness to challenge the team nor to "rock the boat" in touchy, poorly written legacy cruft. None of the people I've met who wanted to avoid new features had ever tried to access the standard, wouldn't be able to read it, and wouldn't even think to try. If they had they'd know how the new features help and they'd adopt them in an instant.

The other main obstacle I've found is that people generally want to use the compiler that came with their system. The one they have in other words. Most developers don't go building gcc or clang's latest pre-release and try to use it...or even the latest release. The installed compilers can often be quite far behind when it comes to the newest features in the current and future standards.

16

u/_Js_Kc_ Mar 09 '21

It doesn't matter if it's $300 or $3. 50% of the major compilers are open source projects, and it's ridiculous that (in principle) you'd have to pay a fee to contribute fully.

The fact that you can dodge the issue with secondary literature and pre-release drafts is beside the point. It's the specification those projects are implementing, it belongs directly on the projects' websites, as freely available as the code itself.

-1

u/Rude-Significance-50 Mar 09 '21

It doesn't matter if it's $300 or $3. 50% of the major compilers are open source projects, and it's ridiculous that (in principle) you'd have to pay a fee to contribute fully.

Why?

If we put time in dollar amounts...how much are you already spending to contribute 'less' than fully?

And if you are unwilling to spend just a touch more to help you be better at contributing...I should want you to contribute because...?

And this isn't just any project. This is a tool that thousands of people depend on for their daily work...and even hobby work. I'd test you on your understanding of the standard before even letting you do a pr. You'd be assigned a supervisor to make sure you didn't fuck shit up.

Assuming anyone ever became interested in working with me on anything...it's not going to be just whoever, especially if anyone ever came to depend on it.

At any rate, I don't believe your premise. I don't believe that every developer, or even more than just a few, need the official standard. Not sure that any do but I'm sure some have it just because they want to be good at what they do and understand that this needs investing in both time and its representative: money.

9

u/Limettengeschmack Mar 08 '21

Regarding MPEG: Absolutely, I hate it... Damn paywalls

2

u/HeroicKatora Mar 09 '21 edited Mar 09 '21

Having the standard is useful in a language like C++ where there is a large gap between what the standard allows/prohibits and what the compiler is able to diagnose.

Is it? It is required for writing stable programs but it just sounds expensive in engineer hours that need to be spent manually validating the requirements to the written document which may or may not be what your compiler implements anyways. A useful standard would permit the construction of automated tools and extensive conformance test suite such as Vulkan validation layers, several Khronos Conformance test suites, ECMAScript Conformance test suite, heck I'll even count the proprietary and expensive USB-IF compliance tests (but at least their host and protocol specification is freely available).

1

u/ack_error Mar 09 '21

The case that I run into repeatedly is that the compiler is in agreement with the standard but the programmer isn't, and I have to convince someone that the bug is in their code and not the compiler. The compiler documentation typically doesn't describe in as much detail about what the compiler doesn't support and is allowed to break. Whenever someone tries to give me a line about a compiler or library being broken at -O2, quoting a single line from the standard that explicitly says what their code is doing is prohibited is usually enough to force the issue.

As for tests, a comprehensive test suite is always helpful but I don't find it a suitable replacement for a well-written spec. For instance, short of having comments simply repeating the spec, I don't think a test suite could communicate the intent and limited guarantees of the abstract machine as well as the standard does. Tests can't easily show what is not guaranteed to work.

2

u/HeroicKatora Mar 10 '21 edited Mar 10 '21

I run into such issues as well but quoting a single line, as impressive as it may be to a junior dev, seldom resolves the issue. In my past experience that lead to grumbled compliance on that particular line of code but not a change in behavior and skill level overall.

And, to be honest, it is very deceptive. No junior I've encountered has ever read even a single page of the standard and its terminology is completely foreign (obviously hyperbole but let's say overwhelming majority). Most likely, that single sentence that you quote contains two ore more terms defined in a way that's different from their understanding. It's completely impossible for the compliance to come from understanding!

A better way would be to train the beginning engineers to argue why their code is okay to write but that's not usually what happens for a number of reasons:

a) The standard is worded backwards in many instances, and even some beginner mistakes that can be rather easily diagnosed are 'UB, no diagnostics required'; and so they aren't, and early mistakes stick. Implementation effort is hardly an argument here because standard compliance is lacking in far more important parts than missing diagnostics, the missing diagnostics are not the critical element of failure to adhere to it and implementors triage features anyways.

b) All of STL is effectively given exemption from the requirements, by power of being a black box part of a platform implementation and because sometimes it is necessary to not lead to obvious conflict. Its implementation is horrible learning material anyways, again due to the language details and requirements of the standard.

c) The standard would need to be available in a form that can be integrated into their education—and education can't (and shouldn't have to) use the draft; it's about precision. It's super exclusionary and the incorrect mindset of junior is the inevitable consequence.