This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
use of const keyword
- From: bostjanv <bostjanv at alum dot mit dot edu>
- To: gcc-help at gcc dot gnu dot org
- Date: Sun, 7 Dec 2014 07:43:36 -0700 (MST)
- Subject: use of const keyword
- Authentication-results: sourceware.org; auth=none
Hello,
I am verifying a simple fact concerning the use of the const keyword.
I wrote the following simple program
============================
const int a=10;
const int b=a;
int main(int argc, char *argv[]) {
}
============================
I tried it out with gcc, version 4.7.2 on Debian 7, and the result was the
following:
============================
bostjan@wwpecker-5-deb:~/workspace/OB2/src$ cc -c -o test.o test.c
test.c:3:1: error: initializer element is not constant
b
============================
QUESTION: Is there a way to initialize a const to the value of another
const?
Regards,
bostjanv
--
View this message in context: http://gcc.1065356.n5.nabble.com/use-of-const-keyword-tp1098889.html
Sent from the gcc - Help mailing list archive at Nabble.com.