[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Who's responsible for kdelibs/arts/flow/gsl ?
From:       kde-devel () thewrittenword ! com
Date:       2001-10-24 13:22:12
[Download RAW message or body]

On Wed, Oct 24, 2001 at 03:04:18PM +0200, Thomas Leitner wrote:
> Who's responsible for kdelibs/arts/flow/gsl? This library seems to
> depend on GCC to a large extend. For instance with an ANSI-C compiler
> I get this:
> 
> cc: Error: gslfilter.c, line 33: In the declaration of "poly", "iorder" is
> not constant, but occurs in a context that requires a constant expression.
> (needconstexpr)
>   GslComplex root, poly[iorder + 1];
> ------------------------^
> 
> cc: Error: gslmath.c, line 85: In the declaration of "tbuffer", "n_points"
> is not constant, but occurs in a context that requires a constant
> expression. (needconstexpr)
>   char *s, tbuffer[FLOAT_STRING_SIZE * 2 * n_points];
> -------------------------------------------^

The fix is easy. C89 doesn't allow you to allocate an array of
non-const size (I think C99 might though). Just do:
  GslComplex root, *poly;
  poly = malloc (iorder + 1);

  char *s, *tbuffer;
  tbuffer = malloc (FLOAT_STRING_SIZE * 2 * n_points);

Of course, don't forget to free().

-- 
albert chin (china@thewrittenword.com)
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic