Thursday, June 14, 2007

C++ and C FAQ

Source

  • Comeau C++ and C FAQ
  • Embedded System Design
  • C++ FAQ LITE

    Description

    You can probably find answers to the fundamental questions about c++ programming.

    Memo

    • Constant objects can be declared with various types and user can access the address of the constant objects.
    • Enumeration Constants can only be integers and the address of enumeration constant is not available. But it also means that compilers won't generate codes for the ability to take the address, which becomes an advantage of using enumeration constants if users do not need the address of the constant.
    • When writing class template, the definition and the declaration should "be seen by compiler at the same time," which means one may 1. write both the declaration and the implementation in the same file (the .h file); 2. include the implementation file (.cpp) in the header file (.h), not include the header file in the implmenetation file. To explain this in one sentence: A class template is not a real class and the compiler will not see the functions of the class template with specified type.

  • No comments: