Abridged

The abridged reference card is now in version 0.16. If someone wants to join in, please let me know.

http://home.uevora.pt/~pmaa/cpp.pdf
Small note: that document assumes that source files are *.cpp and headers *.h
But there are many other possibilities ( eg: .cp .C .c++ .cc .cxx are interpreted as C++ sources by default on g++ )
Yes, I know, but it is impossible to put the whole 2003 norm document in a quick reference of the same size. There are many ingredients of C++ which were simply ignored since they aren't crucial. I bought many books (I have -or-read- all the classics) and none is nearly complete in terms of syntax.

What I wrote is just the essential. How many people you know using .cp as extension?

C++0x is mostly ignored (well, the auto keyword is there) since I was expecting for someone to help me.

As for the Standard Library, another document must be written.

P.
The file naming is not part of the standard
You can make your document more accurate if you omit the file extension ( such as in #include "<file>.h" ) .hpp is very common for headers file
I agree, just checked the widely available facsimile of the C++03 standard and already uploaded the modified text.

As for .hpp, Stroustrup's TC++PL 3ed states that (pp 201-202)

Header files are conventionally suffixed by .h, and files containing function or data definitions are suffixed by .c. They are therefore often referred to as ‘‘.h files’’ and ‘‘.c files,’’ respectively. Other conventions, such as .C, .cxx, .cpp, and .cc, are also found. The manual for your compiler will be quite specific about this issue.


Last edited on
For example const T var = expr |( expr ) can be replaced by either bool b=true or bool b(if(x==3)).
what?

Well, obviously the if shouldn't be there.

However, a declaration can invoke either the explicit or implicit form of copy constructor which can also be used for pre-defined types:

1
2
3
4
5
6
7
8
9
double d1=0.0;
//and 
double d2(0.0);
//and 
double d3=double();
//and
double d4(double());
//and
double d5(d4);


initiate with the same value

and this is also allowed:
1
2
int x=3;
bool b(x==3); // corrected form 


In section 1.1, the notation for options and the examples provided seem ambiguous. I don't think you meant that
x==3
is a valid replacement for
const <T> <var>=<expr>|(<expr>)
and I think you meant to write "const" before each of the expressions in the example, but aside from that, there remains ambiguity as to how much of the LHS of the '|' is included in the "optional part" so I think the entire '|'-separated option list should be enclosed in a pair of brackets.

For example, I can take that to mean that
const int x = y
may be replaced by
const int x = (y)
or
const int x(y)
or
const int (x)
or
const (x)
or
(x)

In other words,
const <T> <var>< = <expr>|(<expr>) >
Version .17 (same link) has these issues solved. And more contents too.
No, I still don't see anything in the notation that says that the '=' is part of the expression to be replaced, i.e., that "= <expr>" is to be replaced by "(<expr>)"
The space indicates that. It was after the "=" sign but is now in the correct position.

I will insert a few syntax ingredients in the next revisions and further defects will be ironed out.

It looks good, though, doesn't it?
Last edited on
Topic archived. No new replies allowed.