unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Rob Browning <rlb@defaultvalue.org>
Subject: #if vs #ifdef
Date: Thu, 27 Mar 2003 00:18:08 -0600	[thread overview]
Message-ID: <87brzxfi3j.fsf@raven.i.defaultvalue.org> (raw)


The GNU Coding Standards suggest always #defining a symbol to a value
and using #if tests rather than either defining or not defining that
symbol and using #ifdef or #ifndef.  i.e. instead of "#define FOO",
use "#define FOO 1", and use "#define FOO 0" rather than not defining
it at all.

One reason for this recommendation is that they then encourage you to
write code like this:

  if (SCM_HAVE_ARRAYS)
    {
      ...

rather than using #if/#ifdef/etc. at all.  Their argument is that all
reasonable compilers will generate the same code either way, and using
C code rather than the preprocessor can substantially improve the
readability of the code and allow the C compiler to do more thorough
analysis of all code paths.

Thoughts?  Since I just added new public defines, this seems a good
time to ask.

Thanks

-- 
Rob Browning
rlb @defaultvalue.org, @linuxdevel.com, and @debian.org
Previously @cs.utexas.edu
GPG starting 2002-11-03 = 14DD 432F AE39 534D B592  F9A0 25C8 D377 8C7E 73A4


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


             reply	other threads:[~2003-03-27  6:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-27  6:18 Rob Browning [this message]
2003-03-27  9:43 ` #if vs #ifdef tomas
2003-03-27 12:48 ` Dale P. Smith
2003-03-27 15:26   ` tomas
2003-03-27 15:08     ` Dale P. Smith
2003-03-27 15:56   ` Rob Browning
2003-03-27 15:13 ` Marius Vollmer
2003-03-27 19:47   ` Rob Browning

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87brzxfi3j.fsf@raven.i.defaultvalue.org \
    --to=rlb@defaultvalue.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).