This is the mail archive of the gcc-bugs@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]

no warning when assigning an unsigned int to signed double


Hello, 
    I'm not sure if this is a bug:
    ============
    size_t i = 3;
    double d;
    d = -i;
    cout << d << endl;
    ============
    compile is ok without any warning with -Wall flag.

    and I get:4.29497e+09

    But what I want is -3

    Clearly here gcc should generate a warning message when assigning an
    unsigned int to signed double. Or people may not get what they want.

    I'm using gcc3.2 on BSD. 
-- 
                                     Sincerely yours,
                                            Zhang Le


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