From tlumley@u.washington.edu  Mon Jul  8 16:41:31 2002
From: tlumley@u.washington.edu (Thomas Lumley)
Date: Mon, 8 Jul 2002 08:41:31 -0700 (PDT)
Subject: compilation breaks with gnome support on hp-ux 11.00 (PR#1757)
In-Reply-To: <x2eleel2ur.fsf@biostat.ku.dk>
Message-ID: <Pine.A41.4.44.0207080833220.40592-100000@homer21.u.washington.edu>

On 8 Jul 2002, Peter Dalgaard BSA wrote:

> mgansser@rand.de writes:
>
> > cc: "system-showfiles.c", line 271: error 1502: Array size must be a constant
> > expression.
> > gmake[4]: *** [system-showfiles.lo] Error 1
> >
> > gnome-1.4 for hpux 11.00
> > PS: R-1.5.1 compiles fine w/o gnome support
>
> 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??
>

It's not in ANSI C89, though it is in C99.

The initialiser must be a constant expression and in C (but not C++) a
const-qualified variable doesn't qualify.

The reason I've seen for this is that the value of a const-qualfied
variable is known at link time but not necessarily at compile time.


	-thomas

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


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