- basic source character set (no `$@) translated to universal character name (\u + \U)
- (trigraph sequences)
- <newline> at the end of the line are removed (single pass)
- decomposed into comments and preprocessing tokens:
- header names, identifiers, numbers, literals, etc.
- operators + punctuators
- transformations inside double quotes are reverted
- each comment replaced by a single space
- preprocessor executed -> all preprocessor tokens are removed
- literals are converted from source character set to execution character set
- adjacent string literals are concatenated
- ��compilation executed (syntactic analyzation and semantic analyzation)
- each TU examined to procude list of template instantiations
- definitions of templates and required instantiants are perfromed to produce instantiation units (IU)
- TUs, IUs, and libraries needed to satisfy external references are collected into program image
- linking takes place
-
-target-cpu core2
-
-target-linker-version 253.9
-
-dwarf-column-info
-
-fdebug-compiliation-dir $CURDIR
-
-ferror-limit "19"
-
-fmessage-length "135"
-
-munwind-tables
-
-mrelax-all
-
-mrelocation model pic -pic_level
-
-mthread-model posix
-
-mdisable-fp-elim
-
-masm-verbose
-
-Wdeprecated=obj-isa-usage
-
-Werror=obj-isa-usage
-
-main-file-name 'a.c'
-
-lc++
-
-stdlib=c++
-
-fdeprecated=macro
-
-fcxx_exception
-
-fexceptions
-
-E : preprocessing
-
-f : syntax only
-
-S : assembly code (GA)
-
-c : normal compilation
- implicit assignment from void* in C
in C: always cast the result to the corresponding type (e.g.
int *ptr = (int*) malloc(sizeof(int));
) - string literals are char[] in C, char const[] in C++ in C: always assign string literals to char const[], instead of char[]
- new + new[] instead of malloc, calloc, etc. Nothing you can do about it, avoid malloc in C++
- necessity of declaration of function before use in C++ do that in C as well
- typedef vs. using
- always return from main -> it's just a function!
- in C, main is callable from other functions, but don't do it
- don't skip initializations in C
- Avoid tentative definitions in C
- Don't declare tags in C function prototypes
- don't cast implicit const to non-const
- always initialize const values (not necessary in C++)
- char constant int in C, char in C++
- const globals are file scope in C, not in C++
- @executable_path: relative to directory of main executable
- @loader_path: relative to referring library -> for plug-ins
- @rpath: relative to any list of paths which are passed as arguments when compiling (-rpath)