This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: evaluation order of expressions in gcc
- From: llewelly at xmission dot com
- To: laura_rand at women-at-work dot org
- Cc: gcc-help at gcc dot gnu dot org
- Date: 29 Mar 2004 17:28:45 -0700
- Subject: Re: evaluation order of expressions in gcc
- References: <14310.1080552306@www40.gmx.net>
laura_rand@women-at-work.org writes:
> hi, all
>
> i could not find an answer to this question on the net so i'm posting it
> here.
>
> as far as i know, the Ansi C standard does not specify the order of
> evaluation of expression arguments. so if i wrote:
>
> x = f() + g()
>
> it would be up to the compiler whether f() or g() would be called
> first.
[snip]
There is no order you can depend on. It can vary by platform, and
according to optimization flags.