compilation breaks with gnome support on hp-ux 11.00 (PR#1757)

RenE J.V. Bertin
Tue, 9 Jul 2002 21:29:56 +0200

> Hmm:
> const gint bufsize = 2048;
> gchar buf[bufsize];
> is the culprit, so a quick fix should be obvious (just use #define
> instead). But is this usage of "const" variables an un-ANSI C
> extension in GCC, or is it the HP C compiler that is to blame?? 

Peter (and others):

AFAIK, gcc is the only C compiler that allows this sort of fortran-like syntax. Mighty handy, but not portable at all. However, behind the screens, it translates this (more or less) into a call to alloca(). This is a function that is part of most modern systems, and of which portable versions can be found (outside the glibc source tree). BTW: debugging code that allocates arrays like this is not trivial, as on all systems I've seen, you cannot directly access element n as array[n] (from within gdb, that is).

There is a comprehensive whitepaper about gcc's not-portable-outside-gcc quirks available on Metrowerk's site, called Porting GNU C Programs to Metrowerks' CodeWarrior C Compiler.

r-devel mailing list -- Read
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: