|
|
Subscribe / Log in / New account

File permissions in the kernel

File permissions in the kernel

Posted Aug 5, 2016 7:27 UTC (Fri) by mchapman (subscriber, #66589)
In reply to: File permissions in the kernel by k8to
Parent article: File permissions in the kernel

> There are reasons to prefer defines over const vars. A const int with global visibility occupies memory, while a define may not (it may become an operation immediate).

I have frequently seen enum values used for constants instead of preprocessor macros or const variables. They end up in the program's debugging info, so you can use their names in gdb, but they don't require any memory in the process itself.


to post comments

File permissions in the kernel

Posted Aug 5, 2016 13:55 UTC (Fri) by andresfreund (subscriber, #69562) [Link]

Fwiw, GCC/gdb can do that with macros too. Quite useful. -ggdb seems to do the trick for me.

File permissions in the kernel

Posted Aug 8, 2016 1:39 UTC (Mon) by JdGordy (subscriber, #70103) [Link]

For some reason MISRA (or the subset I'm using at work) forbids #define's so we are stuck using the enum version.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds