摘要:1、消除冗余代码以及避免微妙的goto语句:通常,如果一个函数开始要分配一些资源,然后如果在中途遇到错误则要退出函数,当然,退出前要释放资源一般写法: 1 int InitSomething() 2 { 3 char* pImage = NULL; 4 char* pBitMap =...
阅读全文
摘要:0长度的数组在ISO C和C++的规格说明书中是不允许的,但是GCC的C99支持的这种用法。GCC对0长度数组的文档参考:“Arrays of Length Zero”如下代码片段,哪个更简洁更灵活,看一眼就知道了:#include #include typedef struct tagArray...
阅读全文
摘要:GCC4.10预处理器帮助文档The C PreprocessorTransformations Made GloballyMost C preprocessor features are inactive unless you give specific commands to request t...
阅读全文
摘要:6.6 Referring to a Type withtypeofAnother way to refer to the type of an expression is withtypeof. The syntax of using of this keyword looks likesizeo...
阅读全文
摘要:6.1 Statements and Declarations in ExpressionsA compound statement enclosed in parentheses may appear as an expression in GNU C. This allows you to us...
阅读全文
摘要:1. () (round brackets or parentheses):圆括号2. [] (square brackets):方括号3. (angle brackets):尖括号4. {} (braces) :大括号
阅读全文