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

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: list of djgpp compiler errors wanted!
Date: Tue, 19 Nov 1996 23:09:42 -0800
Organization: Alcyone Systems
Lines: 28
Message-ID: <3292AEB6.5B9D038E@alcyone.com>
References: <32905cab DOT 10273409 AT news DOT uu DOT se>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Martin Gumucio wrote:

> int auks;
> auks = 19.99 + 11.99;
    ...
> utypomv.cpp: In function `int main()':
> utypomv.cpp:10: warning: assignment to `int' from `double'

This is a perfectly legitimate _warning_.  It is a warning, after all, not
an error.  gcc is warning you that you are doing something which looks
suspicious and has a correspondent loss of significance.

> it simply refuses to make me use type casting of any form.

I suspect you're mistaken.  Try 

    auks = (int) (19.99 + 11.99).

This means, "add 19.99 and 11.99 (both doubles).  Then, after you've
computing the result, cast it to an int.  Then assign it to `auks', which
is a variable of type int."

-- 
                             Erik Max Francis | max AT alcyone DOT com
                              Alcyone Systems | http://www.alcyone.com/max/
                         San Jose, California | 37 20 07 N 121 53 38 W
                                 &tSftDotIotE | R^4: the 4th R is respect
         "But since when can wounded eyes see | If we weren't who we were"

- Raw text -


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