Re: printf() print arguments in reversed order

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8 December 2016 at 07:13, lhmouse wrote:
> It is undefined behavior.
>
> The evaluation of three parameters in question is (at the moment) unsequenced.
> Since each of them  contains a function call, the three function calls are also
> unsequenced. The modify-and-read operations inside the function calls are
> unsequenced relative to each other. Hence the UB.

No, that's incorrect. The functions don't interleave. It's unspecified
which order they execute in, but there is no undefined behaviour.

The C++ standard says:
"For each function invocation F, for every evaluation A that occurs
within F and every evaluation B that does not
occur within F but is evaluated on the same thread and as part of the
same signal handler (if any), either A is
sequenced before B or B is sequenced before A."

So they're not unsequenced.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux