Comments by "⃠" (@U20E0) on "Fireship" channel.

  1. 2
  2. 2
  3. 2
  4. 1
  5. 1
  6. 1
  7. 1
  8. 1
  9. 1
  10. 1
  11. 1
  12. 1
  13. 1
  14. 1
  15. 1
  16. 1
  17. 1
  18. 1
  19. 1
  20. 1
  21. 1
  22. 1
  23. 1
  24. 1
  25. 1
  26. 1
  27. 1
  28. 1
  29. 1
  30. 1
  31. 1
  32. 1
  33. 1
  34. 1
  35. ( 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
  36. 1
  37. 1
  38. 1
  39. 1
  40. 1
  41. 1
  42. 1
  43. 1
  44. 1
  45. 1
  46. 1
  47. 1
  48. 1
  49. 1
  50. 1