[Bug c/28038] Double to char conversion fails at 32769.0

schwab at suse dot de gcc-bugzilla@gcc.gnu.org
Thu Jun 15 16:14:00 GMT 2006



------- Comment #3 from schwab at suse dot de  2006-06-15 16:04 -------
It is still undefined to convert a float to an integer that is too narrow.  The
range of short is irrelevant when converting to char.  Since the behaviour is
undefined there is no requirement on the resulting value.  If you want defined
behaviour you must first cast to an integer that is wide enough, then you can
cast to the narrower (unsigned) type.


-- 

schwab at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28038



More information about the Gcc-bugs mailing list