This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: wierd results
- To: george josilo <josilo at lucent dot com>
- Subject: Re: wierd results
- From: Dima Volodin <dvv at dvv dot org>
- Date: Fri, 17 Mar 2000 16:48:15 -0500
- CC: egcs-bugs at egcs dot cygnus dot com
- Organization: Huh?
- References: <38D2A2B5.526B6863@lucent.com>
george josilo wrote:
> I seem to get wierd results when i do:
>
> main()
> {
> int a=0;
> printf("%d %d %d %d\n", a, ++a, ++a, a);
> }
>
> most other compilers (MS), SparcWorks,
> give: 2 2 1 0 (evaluation in reverse order)
>
> gcc(v2.7.2, v2.8.1)
>
> give 2 1 2 2
>
> am I missing something?
Yep. Your program is mailformed - you can change a variable in an
expression only once and you are trying to do that two times.
> ŠorŠe Josilo - mailto:josilo@lucent.com | ZAP ''''
Dima