[libvirt] [PATCH] Add a define for NFS_SUPER_MAGIC

Eric Blake eblake at redhat.com
Wed Mar 3 17:53:34 UTC 2010


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 at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 320 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100303/df812157/attachment-0001.sig>


More information about the libvir-list mailing list