🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Robert Kennedy Fri, 04 Aug 1989 21:28
Bug with variable-length arrays in argument list
#332
Author: Robert Kennedy
Date: Fri, 04 Aug 1989 21:28
46 lines
1564 bytes
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");
}
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads