style: cpp indentation
joel.sherrill at OARcorp.com
Thu May 29 22:14:18 UTC 2014
On 5/29/2014 3:47 PM, Gedare Bloom wrote:
> Any guidance on whether we should have a style rule about CPP
> directives? Mainly this is for #ifdef #endif guards for conditional
> code compilation. There are two options based on what exists in the
> cpukit today:
> 1) Preprocessor directives within indented code should be one nesting
> level outside of the affected code.
> 2) Preprocessor directives within indented code should not be indented.
> You can see an example of both, e.g. at
> cpukit/score/src/threaddispatch.c:111-132 just to pick one.
(1) is historical
(2) is newer
Personally, I lean to (2) and may be the guilty party for much of that code.
Older C tended to always put the cpp #directives in the 1st column. Whether
there were broken compilers or we just followed K&R style, I don't know.
I think style (2) treats the conditionals like C logic and following the
seems to help.
But this is one of those things where I am sure I wrote in style (1) for
and somewhere was exposed to (2) and started using it.
FWIW The GNU Ada run-time for RTEMS should go back to the default of using
POSIX keys. That will fix it for SMP and eliminate some of this code.
> rtems-devel mailing list
> rtems-devel at rtems.org
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherrill at OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the devel