patacongo opened a new issue #994:
URL: https://github.com/apache/incubator-nuttx/issues/994
There has been some controvery lately about the consistency of naming of OS
internal functions. We should come to a consensus on the desired naming of
conventions for internal OS functions before we start arbitrarily changing
names.
NuttX function names are all lower case. That is required by the naming
standard. Historically, has used a subsystem name, an underscore, then all of
the renaming words smooshed together. For example.
void sched_mergeprioritized(FAR dq_queue_t *list1, FAR dq_queue_t *list2,
uint8_t task_state);
I would represent that form as:
<subsystem>_<everythingelsesmooshedaltogether>
Many of these names are impossible to read unless you stop and parse the
letters to find the word boundaries.
Most recent naming has broken out one more of the smooshed-together-words
and separated them with undersore characters like:
unsigned int sched_timer_cancel(void);
void sched_timer_resume(void);
void sched_timer_reassess(void);
Which I would describe as:
<subsystem>_<object>_<verb>
Another form, which I have been using lately, is to switch the `<object>`
and the `<verb>` like:
<subsystem>_<verb>_<object>
For example:
int sched_get_stackinfo(pid_t pid, FAR struct stackinfo_s *stackinfo);
By the `<subsystem>_<object>_<verb>` naming this would have been:
int sched_stackinfo_get(pid_t pid, FAR struct stackinfo_s *stackinfo);
And the timer interfaces would become the following under the
`<subsystem>_<verb>_<object>` rule:
unsigned int sched_cancel_timerl(void);
void sched_resume_timer(void);
void sched_reassess_timer(void);
I won't even consider the `<subsystem>_<everythingelsesmooshedaltogether>`.
It has a history but is pretty much odious
There is other naming that uses long names with many underscore characters
separating each word in the long name. I am personally not a fan of long names.
My preference would be the `<subsystem>_<verb>_<object>` form. I have been
using this form in creating all new internal interfaces. Does anyone else have
a thought? or a preference? We should come to an understand and stop the
arbitrary name changes.
NOTE: This applies only to the internal naming of functions within the OS.
Other names are imposed on us by standards for application interfaces to the OS
which may follow other rules.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]