This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Conversion from double to int by default


On 9 April 2010 07:44, Ivo Hanak <hanak@byte.cz> wrote:
> ?I tried to search the web but I still do not have any clue why it converts
> from double to int by default. This seems pretty dangerous to me. Am I
> missing something?

Because that is how the C++ standard says it should be and g++ is a
C++ compiler so it (aims to) implement the C++ standard. You can use
-Wconversion to get a warning and -Werror=conversion to get an error
for that line. You should also read about -Wall, -Wextra and -Werror
in the documentation.

Cheers,

Manuel.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]