Re: Usage of leading underscore in linux kernel code.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <stman937-linewbie@xxxxxxxxx> wrote:

From: StephanT <stman937-linewbie@xxxxxxxxx>
Subject: Usage of leading underscore in linux kernel code.
To: kernelnewbies@xxxxxxxxxxxx
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 ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux