Re: warning while making cast
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Thu, 05 Jun 2008 09:33:17 -0700
"Roman Mashak" <mrv@xxxxxxxx> writes:
Hello, vippstar@xxxxxxxxx![...]
You wrote on Thu, 5 Jun 2008 04:27:18 -0700 (PDT):
v> The return value of sqrt is implicity converted to long.
In my understanding implicit conversion is a promotion of types, i.e.
without loss of bits. For instance, float to double
I'm afraid your understanding is incorrect.
The promotions that occur for operands of most operators are designed
not to lose information (at least in most cases(?)), but those aren't
the only implicit conversions that can occur. In an assignment or
equivalent (initialization, parameter passing), any arithmetic type
can be implicitly converted to any other arithmetic type. You can
even assign a long double to a char. No diagnostic is required,
though compilers are free to print warnings if they choose.
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
.
- References:
- warning while making cast
- From: Roman Mashak
- Re: warning while making cast
- From: vippstar
- Re: warning while making cast
- From: Roman Mashak
- warning while making cast
- Prev by Date: Re: Marking a Page of Memory Executable
- Next by Date: Re: is order urgent doubt
- Previous by thread: Re: warning while making cast
- Next by thread: Re: warning while making cast
- Index(es):
Relevant Pages
|