Compiling on DEC Alpha

Lars Hecking lhecking@nmrc.ucc.ie
Fri, 12 Nov 1999 19:35:38 +0000



> Ah. oky. You do not have an Standard C compiler. GnuPG requires a
> modern compiler and does not accept old K&R cc with extensions. The
> problem here is that Standard C allows
^^^^^^^ Exactly. This is a p_r_o_b_l_e_m_.
> #if foo
> #include <bar>
> #endif
>
> older compiler only accept
>
> #if foo
> # include <bar>
> #endif
>
> I won't make any chnages to the code becuase I thing that the modern
> form is better readable and we should not stick to ancient syntax
> conventions. A small sed script is your friend here.
I think the latter form is more readable, so there you go. The former obscures the code, and makes it harder to find and separate preprocessor statements. If portability comes at such a low cost, I'd recommend the change.
> Because your compiler has problems anyway, you should install gcc on
> the machine. It does not make sense to use a compiler which would create
> faster code on an Alpha but actually can't compile the source ;-)
There is absolutely no point installing gcc on a platform which comes with a full ANSI C compiler. The cc compiler on Alpha creates better code than gcc, and has less bugs. It also has very nice diagnostics, which often surpass gcc's (can't really say one or the other is better, in general, because both compilers issue a different set of warnings for the same code :-|) To put the Alpha C compiler into ANSI mode (with extensions), use cc -std. This sets __STDC__=0. To put the Alpha C compiler into strict ANSI mode, use cc -std1. This sets __STDC__=1. The compiler can be set at configure time: $ CC='cc -std' ./configure