terralib:convencaoprograma
Diferenças
Aqui você vê as diferenças entre duas revisões dessa página.
| Ambos lados da revisão anteriorRevisão anteriorPróxima revisão | Revisão anterior | ||
| terralib:convencaoprograma [2008/04/02 14:39] – laercio | terralib:convencaoprograma [2008/04/02 19:22] (atual) – laercio | ||
|---|---|---|---|
| Linha 24: | Linha 24: | ||
| * Use macros sparingly | * Use macros sparingly | ||
| * Do not use "# | * Do not use "# | ||
| + | |||
| ===== Example ===== | ===== Example ===== | ||
| <code cpp> | <code cpp> | ||
| Linha 31: | Linha 32: | ||
| static const float TeMaxFloat = 3.4e37; | static const float TeMaxFloat = 3.4e37; | ||
| .... | .... | ||
| - | #endif //end TE_CONNECTION_POOL_H | + | #endif // end TE_CONNECTION_POOL_H |
| </ | </ | ||
| + | |||
| Linha 40: | Linha 42: | ||
| * Do not define enumerations using macros or integer constants | * Do not define enumerations using macros or integer constants | ||
| * Declare enumerations within a namespace or class | * Declare enumerations within a namespace or class | ||
| + | |||
| + | ===== Example ===== | ||
| + | <code cpp> | ||
| + | typedef std:: | ||
| + | typedef std:: | ||
| + | |||
| + | enum TeSelectionMode | ||
| + | { | ||
| + | TeSelectionModeDefault, | ||
| + | TeSelectionModeTePointed, | ||
| + | TeSelectionModeTeQueried, | ||
| + | TeSelectionModeTePointedQueried //!< object pointed and queried | ||
| + | } | ||
| + | </ | ||
| + | |||
| ====== Escopo ====== | ====== Escopo ====== | ||
| * Declare for-loop iteration variables inside of for statements | * Declare for-loop iteration variables inside of for statements | ||
| + | ===== Example ===== | ||
| + | <code cpp> | ||
| + | for (int i = 0; i < 10; i++) | ||
| + | </ | ||
| Linha 110: | Linha 130: | ||
| } | } | ||
| </ | </ | ||
| + | |||
| Linha 116: | Linha 137: | ||
| * Use C++ casting operators instead of C-style casts. Ex:<code cpp> | * Use C++ casting operators instead of C-style casts. Ex:<code cpp> | ||
| - | short a=2000; | + | short a = 2000; |
| int b; | int b; | ||
| b = (int) a; // c-like cast notation - Ok only for fundamental data types | b = (int) a; // c-like cast notation - Ok only for fundamental data types | ||
| - | double d=3.14159265; | + | double d = 3.14159265; |
| int i = static_cast< | int i = static_cast< | ||
| </ | </ | ||
terralib/convencaoprograma.1207147146.txt.gz · Última modificação: 2008/04/02 14:39 por laercio
