From 047dab8e76639ef2682c78b899ee9ba1f7ba28f8 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Fri, 27 Dec 2013 16:45:52 -0600 Subject: update style guide docs to reflect change to (void) --- docs/contributing.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/contributing.rst b/docs/contributing.rst index 620e1b6a..139f7f3b 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -110,14 +110,14 @@ Don't name parameters: ...; }; -Don't include stray ``void`` parameters: +Include ``void`` if the function takes no arguments: .. code-block:: c // Good - long f(); - // Bad long f(void); + // Bad + long f(); Wrap lines at 80 characters like so: -- cgit v1.2.3 From ccd9c0069f6955e8325ec63853e4609241cbea06 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Fri, 27 Dec 2013 20:25:06 -0600 Subject: Convert #defines to explicit type declaration for consistency --- docs/contributing.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'docs') diff --git a/docs/contributing.rst b/docs/contributing.rst index 139f7f3b..336d2acb 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -136,6 +136,23 @@ Include a space after commas between parameters: // Bad long f(int,char *) +Values set by #define should be assigned the appropriate type. If you see +this: + +.. code-block:: c + + #define SOME_INTEGER 0x0; + #define SOME_UINTEGER (unsigned int)0x0001; + #define SOME_STRING "hello"; + +...it should be added to the bindings like so: + +.. code-block:: c + + static const int SOME_INTEGER; + static const unsigned int SOME_UINTEGER; + static char *const SOME_STRING; + Documentation ------------- -- cgit v1.2.3 From 745ee07dcf72bee4dab1d807779be6449a81b96f Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Fri, 27 Dec 2013 20:42:54 -0600 Subject: Fix docs --- docs/contributing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/contributing.rst b/docs/contributing.rst index 336d2acb..63c99530 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -136,7 +136,7 @@ Include a space after commas between parameters: // Bad long f(int,char *) -Values set by #define should be assigned the appropriate type. If you see +Values set by ``#define`` should be assigned the appropriate type. If you see this: .. code-block:: c -- cgit v1.2.3 From 9020b4845a8667a2f400a0fb1b5138cb8d51eaca Mon Sep 17 00:00:00 2001 From: Alex Stapleton Date: Sat, 28 Dec 2013 16:28:59 +0000 Subject: String literals are const char*. GCC won't whine with -Wall because so much code isn't const correct but writing to a string literal is undefined. -Wwrite-strings is the warning flag to enable to spot these. --- docs/contributing.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'docs') diff --git a/docs/contributing.rst b/docs/contributing.rst index 63c99530..657c4359 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -141,17 +141,17 @@ this: .. code-block:: c - #define SOME_INTEGER 0x0; - #define SOME_UINTEGER (unsigned int)0x0001; - #define SOME_STRING "hello"; + #define SOME_INTEGER_LITERAL 0x0; + #define SOME_UNSIGNED_INTEGER_LITERAL 0x0001U; + #define SOME_STRING_LITERAL "hello"; ...it should be added to the bindings like so: .. code-block:: c - static const int SOME_INTEGER; - static const unsigned int SOME_UINTEGER; - static char *const SOME_STRING; + static const int SOME_INTEGER_LITERAL; + static const unsigned int SOME_UNSIGNED_INTEGER_LITERAL; + static const char *const SOME_STRING_LITERAL; Documentation ------------- -- cgit v1.2.3