Re: Is this a bug of the compiler?



 DEVELOP > c-Plus-Plus > Re: Is this a bug of the compiler?

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1
Topic: DEVELOP > c-Plus-Plus
User: "Prateek R Karandikar"
Date: 30 Jun 2004 03:53:29 PM
Object: Re: Is this a bug of the compiler?
John wrote:

The following code:
-------------------------------------
#include <stdio.h>

This is a deprecated header. Use <cstdio>. Even better, use <iostream>.

int a=10
main()
{ printf("a=%d a++=%d ++a=%d \n",a, a++,++a);
return 0;
}
------------------------------------

This code won't compile. What do you mean by
int a = 10 main() { /*...*/}
?

When using gcc, the output is:
a=12 a++=10 ++a=12

When using VC++, the output is:
a=11 a++=11 ++a=11

The code won't compile in the first place. Throw away any compiler that
compiles such code.
-- --
Abstraction is selective ignorance.
-Andrew Koenig
-- --
.

 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER