Hi, Hello,
On Mon, 29 Oct 2018 08:48:46 +0100 "Erwan Gouriou" <erwan.gouriou@linaro.org> wrote:
Making different names is good, but then I think one should be able to identify quickly which is struct and which isn't, What about k_struct_poll_signal or k_poll_signal_struct ? Well, that should be simple: a noun is a struct, so k_poll_signal remains a structure. A subroutine which performs action should contain a verb. To avoid tautology, it may be k_poll_signal_set(). Or perhaps, signals are raised? Then k_poll_signal_raise(). Agree, other projects I've seen do this. That's a basic idea which many projects follow, and which is mostly, but not consistently, seems to be followed by Zephyr. As many other things in Zephyr, such conventions would rather be formalized.
Yeah, we need to formalize it. Flavio, one good way to approach questions like this is to do some research/analysis and offer 3-4 alternative variants for people to choose from (or base further alternatives on). Fairly speaking, I didn't reply earlier in this thread, because I wanted to do such an analysis myself, but as usual, it's backlogged by other tasks.
Yeah, I came up with something I used to see in EFL. Next time I'll present more options. To be honest, I just raised this question thinking that this had already been discussed but not applied. A variant presented above is just a "low-hanging" one. We could go further, e.g.
2. Challenge the name "signal", it may be confusing. 3. Challenge the "_poll" infix part of the name, that's again confusing due to noun/verb ambiguity. Thanks, Paul
On Thu, 25 Oct 2018 at 22:07, Flavio Ceolin <flavio.ceolin@intel.com> wrote:
Hi guys,
MISRA-C rule 5.7 says that a tag name shall be a unique identifier, also reuse tag names is an undefined behavior recognized in C99 (Section 6.7.2.3).
It happens that we have in Zephyr both a struct and a function called k_poll_signal (there may be others cases in the project), the question is, what it is preferable, change the function to something like, k_pll_signal_signal() or change the struct nam ? In the latter, what is the suggestion ? Remembering that I'll follow this pattern if necessary.
Regards, Flavio Ceolin
-- Best Regards, Paul
Linaro.org | Open source software for ARM SoCs Follow Linaro: http://www.facebook.com/pages/Linaro http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog
Regards, Flavio Ceolin
|