From: LBRO <lbro () dscc ! dk>
To: tru64-unix-managers
Subject: C compiler problem
Date: Fri, 21 Nov 1997 13:44:37 +0000 [thread overview]
Message-ID: <96078619210604.tru64-unix-managers.marc@archive.invalid> (raw)
Hi,
All other C compilers that I know of agree that n is a constant when
declared const. However, DEC C V5.2 says it is not.
The following alternatives are possible:
1. It is an error that I have to report to Digital.
2. It is optional and some obscure switch setting will make cc accept
the code.
3. It conforms to ANSI standard (and everybody else are sloppy having
n be a constant-expression when declared const int n = 7).
# cat p.c
main()
{
const int n = 10;
char s[n];
}
# cc -c p.c
cc: Error: p.c, line 4: In the declaration of "s", "n" is not
constant, but occurs in a context that requires a constant expression.
char s[n];
---------------^
#
Yours,
Lars Bro (lbro@dscc.dk)
next reply other threads:[~1997-11-21 13:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-11-21 13:44 LBRO [this message]
-- strict thread matches above, loose matches on Subject: below --
2001-07-03 13:45 C++ compiler problem Padiyath Kumar
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox