Search code examples
c++standards

Whats the best approach to learning logical format and vocabulary needed to read the ISO C++ standard?


On the ISO website https://isocpp.org/std/the-standard they answer the question Why is the standard hard to read?, stating ...

The standard is not intended to teach how to use C++. Rather, it is an international treaty – a formal, legal, and sometimes mind-numbingly detailed technical document intended primarily for people writing C++ compilers and standard library implementations.

They then give a link to some resources where one can learn cpp more easily https://isocpp.org/get-started. This is great, but all resources I can find are geared towards teaching me CPP, when what I want is a resource that helps me learn how to read the standard.

For example, I'm trying to read through ISO/IEC 14882:1998(E) (I use 98 because of work); And if I want to look up functions I see something like this.

In a declarationT D where D has the form

D1 ( parameter-declaration-clause) cv-qualifier-seqopt exception-specificationopt

and the type of the contained declarator-id in the declaration T D1 is “derived-declaratortype-list T,” thetype of the declarator-id in D is “derived-declarator-type-list function of (parameter-declaration-clause) cv-qualifier-seqopt returning T”; a type of this form is a function type86).

I can look up what the vocabulary words mean and generally fill in what's being conveyed but there's details that aren't straight forward. For example what does the opt subscript mean ? Where do I find the rules to how they're using it ? Are there any resources that flesh out these details or at least give an overview that I can reference ?


Solution

  • The standard actually provides you with some of tools you need to read it. Section 4 General principles contains a lot of what you need to know before you start reading the rest of it. For instance, [syntax]/1 has

    In the syntax notation used in this document, syntactic categories are indicated by italic type, and literal words and characters in constant width type. Alternatives are listed on separate lines except in a few cases where a long set of alternatives is marked by the phrase “one of”. If the text of an alternative is too long to fit on a line, the text is continued on subsequent lines indented from the first one. An optional terminal or non-terminal symbol is indicated by the subscript “opt”, so

    
    { expressionopt }
    
    

    indicates an optional expression enclosed in braces.

    So it tells you that opt means optional.