www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/20/08:38:43

From: kagel AT quasar DOT bloomberg DOT com
Date: Wed, 20 Nov 1996 08:12:55 -0500
Message-Id: <9611201312.AA03900@quasar.bloomberg.com >
To: martin DOT gumucio AT mcu DOT uu DOT se
Cc: djgpp AT delorie DOT com
In-Reply-To: <32905cab.10273409@news.uu.se> (martin.gumucio@mcu.uu.se)
Subject: Re: list of djgpp compiler errors wanted!
Reply-To: kagel AT dg1 DOT bloomberg DOT com

   From: martin DOT gumucio AT mcu DOT uu DOT se (Martin Gumucio)
   Date: Tue, 19 Nov 1996 14:25:04 GMT

   I'm just learning c++ but djgpp is complaining on my coding...

   this source is copied right out of my book

   int auks;                                                  
   auks = 19.99 + 11.99;                             


   this is the commandline i use

   gxx SAMPLE.CPP  -o SAMPLE.EXE -lm

   and this came out of the compiler
   utypomv.cpp: In function `int main()':
   utypomv.cpp:10: warning: assignment to `int' from `double'

   it simply refuses to make me use type casting of any form.
   Where can i find a list of all djgpp compiler errorsmessages?


You misunderstand.  This is not an error but a warning so that if you did not
intend to assign the double result of '19.99 + 11.99' to an integer but meant
to declare auks as double you might now discover this coding error.  To
eliminate the warning, assuming the assignment to an integer is intentional,
just add an explicit cast in place of the implied type cast that the compiler
is indeed performing for you:


   int auks;                                                  
   auks = (int)(19.99 + 11.99);                             

The results will be the same either way but you will get rid of the warning.
BTW, you can find the error and warning messages in the source distribution, I
do not think that there is a comprehensive listing in the online docs, though.

-- 
Art S. Kagel, kagel AT quasar DOT bloomberg DOT com

A proverb is no proverb to you 'till life has illustrated it.  -- John Keats

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019