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


printf("%d:%d\n",i,tab[i++]);

based on C standard, whose output is correct?

The program exhibits undefined behaviour: it reads "i" twice while also writing it, without any intervening sequence point. See e.g. 6.5/2 in the C99 standard.


Segher



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