Comments by "⃠" (@U20E0) on "C++ in 100 Seconds" video.

  1. 1
  2. 1
  3. 1
  4. ( warning: length ) I found 2 interesting ones: You can attempt to modify a string literal in C: “abcdefg”[1] = ‘x’; you can deference a void pointer in C, and cast the result of that to void. And an obvious one: C allows implicit casting of void* to any integer type, C++ requires an explicit cast And a few practical ones: In C++, only one “member” of a union can be “active” at a time, which imp defeats the purpose of a union. this: union u { float f, int i }; u.i = 3; return u.f; is valid C but undefined behavior in C++ C allows designed initialization in any order, does not require you to initialize any member, and allows initialization of subobjects and array members. You can redeclare a global variable in C global variables always have external linkage in C unless else specified. In C++ constant globals are internal unless else specified. C allows you to buffer overflow yourself in dumb ways: char c[2] = “abcdefgh”; The size of a character literal is that of an int in C, but that of a char in C++ And a few less practical ones: You can call main() in C You can define main() with any return type in C. in C, for a function declared as int function() {} calling it with arguments will not result in an error, unlike with int function(void) {} you can declare a constant without defining it in C And a few obscure ones: C allows a type definition anywhere where it allows a type: void f ( struct s { int x } s ); C++ would give an error. you can use prefix ++ and — on a bool in C you can goto over a declaration in C given struct S { int i : 1; } S; sizeof( 1, s.i ); is valid C but invalid C++ Someone else can explain why you can declare something as auto without defining it in C you can put way too many const modifiers on a type in C.
    1
  5. 1
  6. 1
  7. 1
  8. 1