This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Projects for beginners
Zack Weinberg wrote:-
> I might go farther: in defaults.h
>
> #ifndef MACRO
> #define MACRO 0
> #endif
>
> then in source
>
> if (MACRO) {
> ... code ...
> }
>
> This increases the likelihood of silly mistakes in rarely-used code
> getting caught by the compiler. It's also often more readable.
Yes. Something I'd like to see is all the gunge that goes in files
at the moment, like
#ifndef MAX_LONG_TYPE_SIZE
#define MAX_LONG_TYPE_SIZE LONG_TYPE_SIZE
#endif
from cppexp.c being defaulted in a common header file somewhere like
this (assuming that is an OK thing to do in general). We seem to
repeat this stuff all over the place.
From toplev.c:
#ifndef ACCUMULATE_OUTGOING_ARGS
#define ACCUMULATE_OUTGOING_ARGS 0
#endif
#ifdef DWARF2_DEBUGGING_INFO
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
#endif
etc. etc.
Neil.