robert@POLYA.STANFORD.EDU (Robert Kennedy) (08/05/89)
Running version 1.35.1- on a Sun 4/110, SunOS:
Variable length arrays as described on page 46 of the manual are
broken.
----------------- begin c++ program ---------------------
#include <stream.h>
void gripe(int a, char c[a])
{
cout << c[0];
}
main()
{
gripe(2, "T");
}
----------------- begin g++ output ---------------------
winge.cc:3: `a' undeclared, outside of functions
winge.cc:5: parameter `c' has incomplete type
In function void gripe (int, _0):
winge.cc:6: `c' was not declared (first use this function)
winge.cc:6: (Each undeclared identifier is reported only once
winge.cc:6: for each function it appears in.)
In function int main ():
winge.cc:13: parameter type of called function is incomplete
------------------------ end g++ output ---------------------
Note also that the following program should compile and work in the
obvious way (but doesn't -- compiler output excluded for brevity):
#include <stream.h>
void multiwinge(int a, char c[][a])
{
cout << c[1][0];
}
main()
{
multiwinge(2, "Should print u");
}