> On 31 Oct 2019, at 01:53, David Blaikie <dblai...@gmail.com> wrote:
> 
>> Yes, but assuming that the GMP adheres to the C standard, there should be no 
>> difference in the arithmetical values produced.
> 
> Not necessarily - C (well, I don't know the C standard as well as I know the 
> C++ standard, admittedly) does allow various variations (implementation and 
> unspecified behavior, for instance). eg: order of evaluation of function 
> arguments (not that this is likely to vary due to optimizations - and doesn't 
> with clang to the best of my knowledge, but as an example of the /sort/ of 
> thing):
> 
>   int f() {
>     static int i = 0;
>     return i++;
>   }
>   int f2(int i, int j) {
>     return i;
>   }
>   int main() {
>     return f2(f(), f());
>   }
> 
> This program could exit with 0 or 1 - both results are valid interpretations 
> of the program per the standard. (again, I don't know the C spec quite as 
> well, so I'm not sure exactly what it says about this code)

Right, but that is something one would avoid when computing arithmetical 
results.


_______________________________________________
cfe-users mailing list
cfe-users@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

Reply via email to