- variables declarations may be mixed with code
- new block scopes for selection and iteration statements
+@section styletypes Type Guidelines
+- use native types (@c int or @c unsigned) if the type is not important
+ - if size matters, use the types from \<stdint.h\> or \<inttypes.h\>:
+ - @c int8_t, @c int16_t, @c int32_t, or @c int64_t: signed types of specified size
+ - @c uint8_t, @c uint16_t, @c uint32_t, or @c uint64_t: unsigned types of specified size
+ - do @b NOT redefine @c uN types from "types.h"
+
@section stylefunc Functions
- static inline functions should be prefered over macros:
int y = f(x1, x2 - x1);
...
}
+@endcode
+- Separate assignment and logical test statements. In other words, you
+should write statements like the following:
+@code
+// separate statements should be preferred
+result = foo();
+if (ERROR_OK != result)
+ ...
+@endcode
+More directly, do @b not combine these kinds of statements:
+@code
+// Combined statements should be avoided
+if (ERROR_OK != (result = foo()))
+ return result;
@endcode
*/
* in blocks such as the one in which this example appears in the Style
* Guide. See the Doxygen Manual for the full list of commands.
*
- * @param foo For a function, describe the parameters (e.g. @a foo).
+ * @param foo For a function, describe the parameters (e.g. @a foo).
* @returns The value(s) returned, or possible error conditions.
*/
@endverbatim
@endverbatim
For an example, the Doxygen source for this Style Guide can be found in
-@c doc/manual/style.txt, alongside other parts of The Manual.
+@c doc/manual/style.txt, alongside other parts of The Manual.
*/
/** @page styletexinfo Texinfo Style Guide
This page provides some style guidelines for using Perl, a scripting
language used by several small tools in the tree:
--# Ensure all Perl scripts use the proper suffix (@c .pl for scripts, and
+-# Ensure all Perl scripts use the proper suffix (@c .pl for scripts, and
@c .pm for modules)
-# Pass files as script parameters or piped as input:
- Do NOT code paths to files in the tree, as this breaks out-of-tree builds.