Live data from Hacker News

C++ Language Quick Guide

viptechworld.blogspot.com

11–20 of 28 posts

Re: C++ Language Quick Guide

#11

> C++ is a superset of C, and that virtually any legal C program is a legal C++ program. This is not true. One example, void* pointers are not automatically converted to "narrower" types in C++ as they are in C.

>"virtually"

There are differences, but they are few and far between.

Re: C++ Language Quick Guide

#12
post #11

> C++ is a superset of C, and that virtually any legal C program is a legal C++ program. This is not true. One example, void* pointers are not automatically converted to "narrower" types in C++ as they are in C.

>"virtually" There are differences, but they are few and far between.

That does disqualify C++ as the __superset__ of C doesn't it?

Re: C++ Language Quick Guide

#13
post #11

Earlier quoted context omitted.

>"virtually" There are differences, but they are few and far between.

That does disqualify C++ as the __superset__ of C doesn't it?

I offer you the infamous phrase "extended superset" made famous in the world of SQL databases :).

(Of course, you're right.)

Re: C++ Language Quick Guide

#14
post #2

Please update the section on storage classes. Auto is no longer a storage class, but a keyword for automatic type deduction. Also, register has recently been deprecated as well, if I remember correctly.

This appears to be a C++03 guide, as it doesn't mention any C++11 features (no range based for). To be fair it is definitely a "quick" guide, and doesn't cover enough to actually be productive in C++ (pointers\memory allocation and references are missing...), but you're right that auto and register are the only things that appear to be explicitly wrong, instead of wrong by omission.

Indeed, this is an awful "guide".

EDIT: ... because a) it's extremely outdated, and b) it doesn't even give you the basics.

Re: C++ Language Quick Guide

#16

> C++ is a superset of C, and that virtually any legal C program is a legal C++ program. This is not true. One example, void* pointers are not automatically converted to "narrower" types in C++ as they are in C.

Syntactically, C++ is a superset of C though, right? I can't think of any C syntax that's not valid C++, but I'm not exactly am expert in either

Re: C++ Language Quick Guide

#18
post #16

> C++ is a superset of C, and that virtually any legal C program is a legal C++ program. This is not true. One example, void* pointers are not automatically converted to "narrower" types in C++ as they are in C.

Syntactically, C++ is a superset of C though, right? I can't think of any C syntax that's not valid C++, but I'm not exactly am expert in either

> I can't think of any C syntax that's not valid C++,

enum toto { a = 1 }; enum toto b = 1;

Fixing versions of both standards could bring in more examples (like trailing comma in enums and use of the names reserved in C++, by the C code).

Overall, ironically, as typing is stronger in C++ (which I agree is a non-syntactic change), poor C code (using lots of unjustified casts), will require less modifications to be compiled as C++.

Re: C++ Language Quick Guide

#19
post #16

> C++ is a superset of C, and that virtually any legal C program is a legal C++ program. This is not true. One example, void* pointers are not automatically converted to "narrower" types in C++ as they are in C.

Syntactically, C++ is a superset of C though, right? I can't think of any C syntax that's not valid C++, but I'm not exactly am expert in either

> I can't think of any C syntax that's not valid C++, enum toto { a = 1 }; enum toto b = 1;

Fixing versions of both standards could bring in more examples (like trailing comma in enums and use of the names reserved in C++, by the C code).

Overall, ironically, as typing is stronger in C++ (which I agree is a non-syntactic change), poor C code (using lots of unjustified casts), will require less modifications to be compiled as C++.

Re: C++ Language Quick Guide

#20
post #16

> C++ is a superset of C, and that virtually any legal C program is a legal C++ program. This is not true. One example, void* pointers are not automatically converted to "narrower" types in C++ as they are in C.

Syntactically, C++ is a superset of C though, right? I can't think of any C syntax that's not valid C++, but I'm not exactly am expert in either

> I can't think of any C syntax that's not valid C++, enum toto { a = 1 }; enum toto b = 1;

Fixing versions of both standards could bring in more examples (like trailing comma in enums and use of the names reserved in C++, by the C code).

Overall, ironically, as typing is stronger in C++ (which I agree is a non-syntactic change), poor C code (using lots of unjustified casts), will require less modifications to be compiled as C++.

Post reply on HN