This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GNU Coding Standards -- updated
- To: Joe Buck <jbuck at synopsys dot COM>
- Subject: Re: GNU Coding Standards -- updated
- From: Carlo Wood <carlo at alinoe dot com>
- Date: Thu, 16 Aug 2001 03:57:23 +0200
- Cc: Gerald Pfeifer <pfeifer at dbai dot tuwien dot ac dot at>, gcc at gcc dot gnu dot org, Mark Mitchell <mark at codesourcery dot com>
- References: <20010815161239.A26894@alinoe.com> <200108160133.SAA11236@atrus.synopsys.com>
On Wed, Aug 15, 2001 at 06:33:25PM -0700, Joe Buck wrote:
> So, for 2.95.2 there is space overhead but (almost) no time overhead
> modulo cache effects; for 3.0 there is neither space nor time overhead.
Thanks for testing!
In that case I whole-heartedly agree with this coding standard;
Old way New way
--
if (x == 0) if (x == 0)
a = 1; a = 1;
else else if (A2)
#ifdef A2 a = 2;
a = 2; else
#else a = 0;
a = 0;
#endif
--
if (x == 0) if (x == 0)
a = 1; a = 1;
#ifdef A2 else if (A2)
else a = 2;
a = 2;
#endif
--
if (x == 0) if (x == 0)
a = 1; a = 1;
#ifdef A2 else if (A2)
else a = 2;
a = 2; else if (x == 1)
#else a = 3;
else if (x == 1)
a = 3;
#endif
--
#ifndef A2 if (!A2 && x == 0)
if (x == 0) a = 1;
a = 1; else
else a = 2;
#endif
a = 2;
Definitely.
--
Carlo Wood <carlo@alinoe.com>