[omniORB] VC6 Compiler Warning?

Quinlan, Mike MQuinlan@idahopower.com
Wed, 25 Apr 2001 09:36:43 -0600


With my version of Visual C++ (6.0 with service pack 5), appending the F
does remove the warning.

-----Original Message-----
From: Duncan Grisby [mailto:dgrisby@uk.research.att.com]
Sent: Wednesday, April 25, 2001 8:42 AM
To: Olaf Meding
Cc: omniORB Mailing List
Subject: Re: [omniORB] VC6 Compiler Warning?


On Wednesday 25 April, "Olaf Meding" wrote:

> Here is the code produced by the IDL compiler that causes the warning:
>   extern const CORBA::Float invalidFloat=-1.00000001335e-010;
> 
> AFAIK the constant should be appended with an F (for float)?

Does appending an F actually suppress the warning?  My guess is that
it's actually warning about the .00000001335 at the end, which exceeds
the precision of float, rather than the fact that the literal has type
double. The ending is just because 1e-10 can't be represented
precisely in binary floating point. The IDL compiler doesn't bother to
truncate away rubbish at the end of the value since it doesn't
matter. If appending F fixes it, then the fix to the IDL compiler is
simple; if not, it'll mean a bit of tricky string formatting.

This hasn't come up before since I guess people don't tend to use
floating point constants.

Cheers,

Duncan.

-- 
 -- Duncan Grisby  \  Research Engineer  --
  -- AT&T Laboratories Cambridge          --
   -- http://www.uk.research.att.com/~dpg1 --