[omniORB] VC6 Compiler Warning?
Olaf Meding
olaf@tomotherapy.com
Wed, 25 Apr 2001 10:30:33 -0500
Duncan,
> Does appending an F actually suppress the warning?
Yes it does. Added an "F" (see below) to the constant and the warning went
away.
#if defined(HAS_Cplusplus_Namespace) && defined(_MSC_VER)
// MSVC++ does not give the constant external linkage othewise.
namespace tcorba {
extern const CORBA::Float invalidFloat=-1.00000001335e-010F;
}
Olaf
-----Original Message-----
From: dpg1@uk.research.att.com [mailto:dpg1@uk.research.att.com]On
Behalf Of Duncan Grisby
Sent: Wednesday, April 25, 2001 9: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 --