This is the mail archive of the gcc-help@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]
Other format: [Raw text]

Re: output difference between VC and gcc


On 07/17/2010 05:17 AM, Mihai DonÈu wrote:
> On Saturday 17 July 2010 06:48:35 Peter wrote:

>> I have the following code compiled in both microsoft VC 2008 and gcc
>> version 4.1.2 20071124.
>>
>> The output is different.
>>
>> #include<stdio.h>
>> void main(void)
>> {
>>     int i,tab[]={1,2,3,4,5,6,7,8,9,10};
>>
>>     i=0;
>>     while(i<10){
>>         printf("%d  ",i);
>>         printf("%d:%d\n",i,tab[i++]);
>>     }
>> }
>>
>> [...]
>>
>> based on C standard, whose output is correct?
>> thanks.
> 
> GCC's, although it's interesting that visual studio does what one expects: 

Actually, both are correct.

Andrew.


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