
According to Chris Lalancette on 3/3/2010 10:44 AM:
#ifdef __linux__ # include <sys/vfs.h> # ifndef NFS_SUPER_MAGIC # define NFS_SUPER_MAGIC 0x6969 # endif /* NFS_SUPER_MAGIC */ #endif /* __linux__ */
I do it without indentation because I vaguely remember that spaces in preprocessor directives are not standards compliant.
With K&R preprocessors, the # had to be in column 1, but you could have space between the # and the directive. But C89 (21 years ago!) changed things and required support for arbitrary indentation on both sides of # (not that everyone obeyed C89 right away, but still...). Autoconf-generated files are proof of the portability of arbitrary CPP indentation - just look at ./configure, and notice all the sample C programs it compiles, with preprocessor indentation all over the place.
That may not be true anymore, and/or I might be mis-remembering, but that's the reason. I don't really care either way; I'm happy to indent it if that is the agreed-upon way to do it.
Jim introduced me to it via coreutils and gnulib, and it really does save some headaches when dealing with deep nestings of #ifdef (of course, the goal is to not nest deeply in the first place; but even that goal is served by following consistent indentation rules, to call visual attention to the depth). -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org