I am working on a C data structures library and I want my code to be clear, not having too much comments and still being readable, but I am struggling with naming.
sinit()
and linit()
or stackInit()
and listInit()
to differentiate Stack and List functions?list_t *ls
or list_t *list
?datasize
or dataSize
?cmp
or compare
?I know all this questions are mostly the same, but I needed to make all cases in the code clear.
stackInit()
and listInit()
are more readable thean sinit()
and linit()
.
The same way the declaration list_t *list
is more readable than list_t *ls
.
As for function names you are using the camel style then it is better when variable names differ from function names. So I would prefer to use datasize
or data_size
instead of dataSize
.
cmp
is a common used synonym for the word compare
or comparison
. There is such an assembler command for Intel processors. So you may use either cmp
, compare
or comparison
.