What are the naming conventions commonly use in C? I know there are at least two:
I am talking about C only here. Most of our projects are small embedded systems in which we use C.
Here is the one I am planning on using for my next project:
C Naming Convention
Struct TitleCase
Struct Members lower_case or lowerCase
Enum ETitleCase
Enum Members ALL_CAPS or lowerCase
Public functions pfx_TitleCase (pfx = two or three letter module prefix)
Private functions TitleCase
Trivial variables i,x,n,f etc...
Local variables lower_case or lowerCase
Global variables g_lowerCase or g_lower_case (searchable by g_ prefix)
The most important thing here is consistency. That said, I follow the GTK+ coding convention, which can be summarized as follows:
MAX_BUFFER_SIZE
, TRACKING_ID_PREFIX
.GtkWidget
, TrackingOrder
.gtk_widget_show()
, tracking_order_process()
.GtkWidget *foo
, TrackingOrder *bar
._refrobnicate_data_tables()
, _destroy_cache()
.