Is this a bug of the compiler?

From: John (johncrane_at_yahoo.com)
Date: 06/30/04


Date: 30 Jun 2004 08:55:00 -0700

The following code:
-------------------------------------
#include <stdio.h>
int a=10
main()
{ printf("a=%d a++=%d ++a=%d \n",a, a++,++a);
  return 0;
}
------------------------------------
When using gcc, the output is:
a=12 a++=10 ++a=12

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

None of them seems reasonable.
Can anybody give a pointer on this?


Quantcast