emacs-devel
[Top][All Lists]
Advanced

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

Re: CPP indentation bikeshed (was: Emacs master build failing on RHEL 6.


From: Paul Eggert
Subject: Re: CPP indentation bikeshed (was: Emacs master build failing on RHEL 6.8)
Date: Wed, 8 May 2019 21:25:22 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

Stefan Monnier wrote:
CPP doesn't know anything about C's
syntactic structure (such as {...} nesting)

That's going a bit too far, as cpp does knows about C's comments and about C's parentheses and commas. True, cpp pays no special attention to { and }.

My own feeling is that in cases like these, utility trumps philosophical consistency. When an '#if' is required but otherwise has the function of a plain 'if', the code is clearer when indented consistently with plain 'if' as this gives the reader a simple and helpful visual cue: an indented "#" means that the preprocessor code is following the normal C syntactic structure, whereas an unindented "#" means the preprocessor code is unusual and is breaking the normal C structure. Always shoving the "#" to the left loses this useful information and forces the reader to work harder.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]