2) \ + a new line. Line continuation even inside a quote.
3) And of course this is valid: const char *mystring = "Hello" "World";const char *mystring = "Hello \
World";
4) And this:
5) Every line of code should be terminated with a new line. Although most compilers won't complain about it.#define otherstring "New"
const char *mystring = "Hello" otherstring "World";
6) int x=016; // Decimal value is 14 because a leading zero makes something OCTAL
7) /* This comment is /* invalid */ because inline comments don't nest */
8 ) #define THAT(X) is ok. #define THAT (X) is not ok because of the extra space before the paren.
9) This 634L is a long, this 634u is unsigned and this 634ul is an unsigned long.
10) Every time I stopping using preprocessor stringification symbols # and ## for any length of time, I forget how they work again
Code: Select all
#define ENUMDEF(_name,_default,_flags) \
{ #_name , fc_##_name },
11) As far as I know, all functions are type extern unless declared static. There is a real use for extern with functions, I just can't remember what it is.
12) "int j;" if inside a function, j is undefined. If outside a function, j = 0. But "static int j;" inside or outside a function are both 0. This is because inside
13) sizeof is an operator. It does not require parenthesis. int j; int k = sizeof j; int m = sizeof(j); // Both j and m will be 4 on pretty much any platform in 2015.
14) Preprocessor directives must be at the start of their own line (allowing for whitespace).
15) Arrays. You can do this: int my_numbers [] = { 4,5,6,7, }; Note the trailing comma after the last element.
16) Offsetof isn't a function. It is a really screwy macro! #define offsetof(s,m) (size_t)&(((s *)0)->m)
17) The C assert statement (which conditionally kicks out an error when debugging) expects NDEBUG to be defined in a release build.