[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Warning in g++ vs gcc
From: |
Mathieu Malaterre |
Subject: |
Warning in g++ vs gcc |
Date: |
Fri, 29 Jul 2005 17:28:53 -0400 |
User-agent: |
Debian Thunderbird 1.0.2 (X11/20050602) |
Hello,
I must be missing something really simple but how does one work
around this :
$ cat demo.c
int main()
{
int k = 375;
double a = 3.75;
k /= a;
return 1;
}
$ g++ demo.c
demo.c: In function `int main()':
demo.c:5: warning: converting to `int' from `double'
whereas the gcc compilation does not raise anything.
Anyone to clear the distinction between gcc behavior and g++ ...
Or at least a way to get rid of this warning, I have trouble
understanding why this code is considered dangerous.
Thanks,
Mathieu
Using: g++ --version
g++ (GCC) 3.3.5 (Debian 1:3.3.5-13)
Can reproduce with g++-4.0 (GCC) 4.0.1 and g++ (GCC) 4.1.0 20050719
- Warning in g++ vs gcc,
Mathieu Malaterre <=