Hi Stephan,

Someone else will promptly give you a more accurate answer, I'm sure.  However, 
the convention in many systems is to use a leading underscore for low level 
functions that do little validation and should therefore not be used directly.  
Hence in kernel code this might also work as a warning, that you should not use 
these functions unless you know what you're doing.

Regards!

--- On Thu, 6/17/10, StephanT <[email protected]> wrote:

From: StephanT <[email protected]>
Subject: Usage of leading underscore in linux kernel code.
To: [email protected]
Date: Thursday, June 17, 2010, 2:00 PM

Hello,

The linux kernel code is full of variable or function names starting with 
leading
underscore(s). Example from include/linux/kernel.h :

#define ALIGN(x,a)              __ALIGN_MASK(x,(typeof(x))(a)-1)

or

void __might_sleep(char *file, int line);

C reserves such names for its own use and prohibits usage in the source code.


Could somebody, please explain this behavior and if there are naming rules 
concerning leading underscores in kernel detail them.

Thanks,
Stephan.

p.s. If there is some document about - just point me to it.


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [email protected]
Please read the FAQ at http://kernelnewbies.org/FAQ




      

Reply via email to