Abridged

Nov 24, 2010 at 2:55pm
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
Nov 24, 2010 at 4:25pm
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++ )
Nov 24, 2010 at 4:46pm
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.
Nov 24, 2010 at 5:20pm
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
Nov 24, 2010 at 6:04pm
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 Nov 24, 2010 at 6:26pm
Nov 24, 2010 at 6:30pm
For example const T var = expr |( expr ) can be replaced by either bool b=true or bool b(if(x==3)).
what?
Nov 24, 2010 at 7:02pm

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 


Nov 27, 2010 at 6:38pm
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>) >
Nov 29, 2010 at 9:59am
Version .17 (same link) has these issues solved. And more contents too.
Nov 29, 2010 at 10:09pm
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>)"
Nov 29, 2010 at 10:45pm
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 Nov 30, 2010 at 11:28am
Topic archived. No new replies allowed.