www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/10/02:36:10

Date: Thu, 10 Aug 2000 08:50:32 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Lets Go Canes! <LetsGoCanes AT webmail DOT bellsouth DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: Conversion warnings
In-Reply-To: <200008092306.TAA18952@websmtp1.bellsouth.bigfoot.com>
Message-ID: <Pine.SUN.3.91.1000810084639.28655F-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 9 Aug 2000, Lets Go Canes! wrote:

> gcc -Wconversion -c test.c
> test.c: In function `main':
> test.c:11: warning: passing arg 1 of `f' as `float' rather than `double' due to prototype
> test.c:11: warning: passing arg 2 of `f' with different width due to prototype

These are the warnings you asked for with -Wconversion.  The essense of 
the warning is this: GCC tells you that any code which does not have the 
prototype visible at compile time will work incorrectly.

The reason is that C, by default, promotes all float variables to double
and all char variables to int, when passing them to functions. 

To make those warnings go away, change the definition of `f' so that it 
accepts double and int rather than float and char.  Then the code will 
work even without the prototype.

- Raw text -


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