🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #50088

variable-length arrays

#50088
From: Steve VanDevender
Date: Mon, 22 Nov 1993 01:46
28 lines
1788 bytes
I am trying to use variable-length arrays (advertised as an
extension of GCC) in G++ 2.4.5 compiling 80386 code for Linux.  I
can declare and use a variable-length array as an auto variable
in a function; however, trying to declare a variable-length array
as a function parameter (which the GCC info files claim is
possible) gives me an error message.  For example:

void gauss-seidel(int size, double A[size][size], double X[size],
                  double K[size], double epsilon)
{
  ...
}

when compiled gives the error

`size' was not declared in this scope

which appears for each instance of 'size' as an array dimension.

I have tried predeclaring 'size' with "int size; int size, ...",
which does not help.  Is this a currently supported feature of
GCC?  Is there something about G++ that I am unaware of that is
preventing the use of a variable-length array parameter?
--
Steve VanDevender 	stevev@greylady.uoregon.edu
"Bipedalism--an unrecognized disease affecting over 99% of the population.
Symptoms include lack of traffic sense, slow rate of travel, and the
classic, easily recognized behavior known as walking."
Technical Details
Message-ID: <STEVEV.93Nov22014614@miser.uoregon.edu>
Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!spool.mu.edu!sgiblab.sgi.com!cs.uoregon.edu!news.uoregon.edu!news.uoregon.edu!stevev

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,5c33205720f65eea,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-11-22 01:43:57 PST
Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!spool.mu.edu!sgiblab.sgi.com!cs.uoregon.edu!news.uoregon.edu!news.uoregon.edu!stevev
From: stevev@miser.uoregon.edu (Steve VanDevender)
Newsgroups: gnu.gcc.help
Subject: variable-length arrays
Date: 22 Nov 93 01:46:13
Organization: University of Oregon Chemistry Stores
Lines: 28
Distribution: world
Message-ID: <STEVEV.93Nov22014614@miser.uoregon.edu>
NNTP-Posting-Host: miser.uoregon.edu