This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

An Ansi-C question or... Is egcs/gcc Ansi compliant?


Hi.

Just playing with const:

const int i=0;
   i++;
   printf("%i\n",i);

You get a warning only (increment of read-only variable) and then both compiles
(egcs&gcc) and 'i' is modified at runtime. I was perplexed and checked this with
other compilers (OSF's, vc++, bcb) and couldn't even compile this.

Why ignore egcs/gcc the const keyword such way?
Is there anyway to get a real const with egcs?

PS: I don't know this message is really on-topic here. If you know of a mailing
list this could fit better, please tell me.

(for USENET postings) Delete 'CUTTHIS' from my e-mail to reply.
        -----------
        Enrique I.R.
 Freelance Sofware Developer.
   Gran Canaria. Spain.
  --aka CtrInt on #Linux--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]