Thinking in C++ Notes(4)
  • type checking is stricter in C++, you are not allowed to simply assign a void* to any other type(C allow this).
  • C compiler can assume that a function you call with an in argument has an argument list containing int, even if it may actually contain a float.
    in C, the external references that the linker searches for are simply function names without types of the argument.
    you define a func(float) and call func(int) then at the calling location an int is pushed onto the stack, but the func() body will expect a float to be on the stack.
  • Instead of requiring you to create a typedef, the C++ compiler turns the name of the structure into a new type name for the program.
  • In C++, you cannot call a function without declaring it first.
  • the variables are all defined "on the fly", that is, they are defined at any point in the scope, rather than being restricted to the beginning of the scope.
  • object oriented programming can be summed up in a single phrase: sending messages to objects.
  • structs with no data members will always have some minimum nonzero size.(1 byte in my machine)
  • what you can put into header files? the basic rule is "only declarations".
  • DON'T put using directives in header file.
  • calling delete for a void* doesn't clean things properly.(details in Chapter13)
  • "gcc -S" produce assembly language.

Last modified on 2007-06-11