public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Implicit casting of the gcc compiler
@ 2004-12-13 20:11 Curt Nowak
  2004-12-13 20:16 ` Eljay Love-Jensen
  0 siblings, 1 reply; 2+ messages in thread
From: Curt Nowak @ 2004-12-13 20:11 UTC (permalink / raw)
  To: gcc-help

Dear Sir or Madam,

I am a student from the German university of hildesheim 
(http://www.uni-hildesheim.de) and I am trying to find out how the gcc 
compiler handles implicit casting.
For more a better understanding, I would like to know the rules that are 
applied when handling something like this:
double d = 1.4;
float fa = 0.4f;
float fb = 0.4f;

int i = d + fa + fb;  // ignoring the warnings

Is there any documentation available that covers this issue? Or can one 
generally say that gcc will do the casting as late as possible?
Thank you in advance,

Curt Nowak

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Implicit casting of the gcc compiler
  2004-12-13 20:11 Implicit casting of the gcc compiler Curt Nowak
@ 2004-12-13 20:16 ` Eljay Love-Jensen
  0 siblings, 0 replies; 2+ messages in thread
From: Eljay Love-Jensen @ 2004-12-13 20:16 UTC (permalink / raw)
  To: Curt Nowak, gcc-help

Hi Curt,

I believe that GCC will do it this way...

int i = (int)((d + (double)fa) + (double)fb);

...which is the way that C/C++ does it.

HTH,
--Eljay

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-12-13 20:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-13 20:11 Implicit casting of the gcc compiler Curt Nowak
2004-12-13 20:16 ` Eljay Love-Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).