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

Re: g++ -fwrapv



On Thu, Mar 23, 2006 at 07:05:21PM +0100, mirek boruta wrote:
> Dnia 23-03-2006, czw o godzinie 04:45 +0100, Efrum napisał(a):
> 
> > Problem nie jest czysto debianowy ale może ktoś będzie wiedział co się dzieje.
> > tohver@Su30:~/mpi$ cat test.cpp 
> > #include <iostream>
> > 
> > int main() {
> > 
> >  int i = -2147483648;
> >  int j = -1;
> >  printf("%d\n", i / j);
> >  return i / j;
> > 
> > }
> > tohver@Su30:~/mpi$ g++ -fwrapv test.cpp 
> > tohver@Su30:~/mpi$ ./a.out 
> > Floating point exception
> > 
> > Dlaczego ta opcja nie działa?
> 
> z man:
> -fwrapv
>     This option instructs the compiler to assume that signed arithmetic
>     overflow of addition, subtraction and multiplication wraps around
>     using twos-complement representation.  This flag enables some opti-
>     mizations and disables others.  This option is enabled by default
>     for the Java front-end, as required by the Java language specifica-
>     tion.
> 
> nie ma mowy o dzieleniu. 

Faktycznie. A więc czeka mnie jednak przerabianie kodu. I kolejne godziny
testów. 
Dzięki za odpowiedzi. 

-- 
Pozdrawiam,

Krzysztof Andrelczyk



Reply to: