Re: www.gnu.org/software/gcc/bugs/#nonbugs_c (with ++ / --)

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

 



On 4 July 2014 08:33, Fabian Cenedese wrote:
>
>>> Nothing defined
>>> implementation of the passage of a function settings. But it turns out that
>>> in the case of gcc, they are pushed onto the stack from right to left.
>>
>>I think it depends on the hardware architecture.
>>
>>> As it
>>> has been since the dawn of time in Savannah, it is definitely impossible to
>>> change this state of affairs in gnou. Thus be it!
>>>
>>>     So my question is: reverse the order of parameters (shock me, but) make
>>> functional! What about you? Portability?
>>
>>I don't understand the question.
>
> He probably means that if he reverses the argument order (like a+=1, b, a) then
> he'd get the desired result. But as you mentioned it probably depends on the
> hardware and compiler so it is not portable.
>
> I'd say this is undefined behaviour and could be solved like
> c=a;
> foo(c, b, a+=1);        // order of evaluation not important

Agreed, that is a safe and portable way to do it.




[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