Skip to contentSkip to conversation

XXX_register or register_XXX

Coding style question Rusty Lynch 4 participants 4 messages Nov 20, 2002 – Nov 21, 2002

lore
Share & tools
lore
#0 lore raw

Is there an accepted standard on naming for registration functions? If have a foo
object that other things can register and unregister with, should the function names be:

int register_foo(&something);
int unregister_foo(&something);

- or -

int foo_register(&something);
int foo_unregister(&something);

-rustyl

#1 lore raw
Quoted 5 lines

Is there an accepted standard on naming for registration functions? If have a foo object that other things can register and unregister with, should the function names be:
int foo_register(&something);
int foo_unregister(&something);

really, that would make the entire kernel code a little simplier to understand.
On the same way, we can say why there is not an accepted standard on naming lock functions, such as

spinlock, rwlock and so on..

That would be more efficient to understand the code... However, where is flexibility?

-hd

#2 lore raw
In reply to Rusty Lynch
Quoted 3 lines · Rusty Lynch

Is there an accepted standard on naming for registration functions? If have a foo object that other things can register and unregister with, should the function names be:

I do not think there is an accepted practice here.

Quoted 2 lines

int register_foo(&something);
int unregister_foo(&something);

I bet this is more common.

Quoted 2 lines

int foo_register(&something);
int foo_unregister(&something);

But I prefer this - I like there to be a namespace for a given subsystem and for it to be a prefix.

Robert Love

#3 lore raw

Em Wed, Nov 20, 2002 at 08:08:28PM -0500, Robert Love escreveu:

Quoted 6 lines · Rusty Lynch
Quoted 2 lines

int foo_register(&something);
int foo_unregister(&something);

But I prefer this - I like there to be a namespace for a given subsystem and for it to be a prefix.

100% agreed. Just look at LLC 8) And yes, the big names was procom's fault, but the way it is structured... I'd love somebody to come up with something that makes it smaller 8)

- Arnaldo