Skip to content

Commit

Permalink
rfc7: add std for variable names and typedefs
Browse files Browse the repository at this point in the history
  • Loading branch information
garlick committed May 27, 2015
1 parent 7aee8d7 commit 9c072ed
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions spec_7.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,37 @@ following exceptions or examples:
int *ptr;
----

=== Variable Names

Variable names SHOULD NOT include upper case letters.
For example `msg_count` is OK, but `MsgCount` or `MSG_COUNT` do not conform.

Preprocessor macro names SHOULD NOT include lower case letters.
For example `FLUX_FOO_MAGIC` is OK but `flux_foo_magic` and
`FluxFooMagic` do not conform.

=== Typedefs

C typedef names SHOULD NOT include upper case letters.

C typedef names for functions SHOULD end in `_f` and SHOULD
be defined as function pointers, for example:
----
typedef int (*flux_foo_f)(int arg1, int arg2);
----

C typedef names for non-functions SHOULD end in `_t`, for example:
----
typedef int my_type_t;
----

Abstract types SHOULD be publicly defined as pointers to incomplete types,
for example:
----
typedef struct foo_struct *foo_t;
----


Tools That Modify Code to Conform to C Coding Style
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down

0 comments on commit 9c072ed

Please sign in to comment.