X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=CodingStyle;h=22f0f458a26f2c0136265db1dc2aa4f7d9b8efb2;hb=5d9895170f5b066d4cb2984fc5a890478a5b8206;hp=b0aeb4e61dcf7452b1d3faf4eb7875eb367b5803;hpb=c214278b0d0e9b574a1f505f14a47d3d8d81aea1;p=sliver-openvswitch.git diff --git a/CodingStyle b/CodingStyle index b0aeb4e61..22f0f458a 100644 --- a/CodingStyle +++ b/CodingStyle @@ -249,6 +249,18 @@ details. (Some compilers also assume that the "if" branch is the more common case, so this can be a real form of optimization as well.) +RETURN VALUES + + For functions that return a success or failure indication, prefer +one of the following return value conventions: + + * An "int" where 0 indicates success and a positive errno value + indicates a reason for failure. + + * A "bool" where true indicates success and false indicates + failure. + + MACROS Don't define an object-like macro if an enum can be used instead. @@ -432,8 +444,8 @@ precedence makes it necessary, or unless the operands are themselves expressions that use && and ||. Thus: if (!isdigit((unsigned char)s[0]) - || !isdigit((unsigned char)s[1]) - || !isdigit((unsigned char)s[2])) { + || !isdigit((unsigned char)s[1]) + || !isdigit((unsigned char)s[2])) { printf("string %s does not start with 3-digit code\n", s); }