Lecture overview -- Keyboard shortcut: 'u'  Previous page: C/C++ Compatibility -- Keyboard shortcut: 'p'    Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Lecture 1 - Page 29 : 29
Notes about C++
From C to C++
C/C++ Compatibility - some small details

Most of details mentioned below do not appear in everyday C programs

  • The C++ Programming Language: Page 816
 

  • Comments

    • // comments are supported in C++ and C99, but not in ANSI C (C89)

  • Functions without argument types

    • Legal in C - but poor style in C. Not legal i C++.

  • A type is int if not specified

    • Possible in C, but poor style. Not legal i C++

  • 'Inline' structs in return type and in parameter lists

    • Possible in C. Not legal i C++.

  • Enumeration types

    • In C a variable of enumeration type can be assigned to an integer.

    • Not possible in C++.

  • Multiple definitions at global level

    • Global data definitions may be repeated in C. Not in C++.

  • Pointers to void

    • may in C be assigned to variables of any pointer type. Not in C++.

  • Static

    • In the meaning of 'local to translation unit' is deprecated in C++.

  • Casts

    • C-style casts should have been decrepated...

    • C++ has other means for casting.

Examples appear in appendix B.2 in The C++ Programming Language