On 11/16/06, Casper.Dik at sun.com <Casper.Dik at sun.com> wrote:
>
>
> >Could you proove that?
>
>
> Probably not, because C++ doesn't allow variable size arrays.
>
> Certainly, Sun's C++ compiler balks at:
>
> int
> main(int argc, char ** argv)
> {
> char *acp[argc];
> }
>
>
> with:
>
> "foo.C", line 4: Error: An integer constant expression is required within the
> array subscript operator.
> 1 Error(s) detected.
Because argc is not an "integer constant expression". :-)
#include <iostream>
using namespace std;
static const int len = 8;
int
main(int argc, char* argv[])
{
char *acp[len];
return 0;
}
This compiles with Studio 11 and -xlang=c99.
--Stefan
--
Stefan Teleman
stefan.teleman at gmail.com