GNU Coding Standards -- updated
Carlo Wood
carlo@alinoe.com
Wed Aug 15 15:22:00 GMT 2001
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>
More information about the Gcc
mailing list