delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/02/02/08:51:58

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
Date: Sat, 02 Feb 2002 15:50:05 +0200
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: "Philip Pemberton" <philpem AT bigfoot DOT com>
Message-Id: <1190-Sat02Feb2002155004+0200-eliz@is.elta.co.il>
X-Mailer: emacs 21.2.50 (via feedmail 8 I) and Blat ver 1.8.9
CC: djgpp AT delorie DOT com
In-reply-to: <a3gjht$1863jp$1@ID-122086.news.dfncis.de> (philpem@bigfoot.com)
Subject: Re: Help: warning: passing arg ... of ... discards qualifiers from pointer target type
References: <a3gjht$1863jp$1 AT ID-122086 DOT news DOT dfncis DOT de>
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

> From: "Philip Pemberton" <philpem AT bigfoot DOT com>
> Newsgroups: comp.os.msdos.djgpp
> Date: Sat, 2 Feb 2002 11:49:48 -0000
> 
> gcc -Wall -O3 -m486   -c -o mpf.o mpf.c
> mpf.c: In function `drawLEDSeg':
> mpf.c:61: warning: passing arg 3 of `polygon' discards qualifiers from
> pointer target type
> [...]
> Someone care to explain this? I've managed to create a short program that
> demonstrates this.
> 
> Compiler cmdline:
>     gcc -o temp.exe temp.c -lalleg
> 
> ---8<---CUT HERE---8<---  TEMP.C
> #include "allegro.h"
> #include "conio.h"
> 
> const int points[12] = {1,2,3,4,5,6,7,8,9,10,11,12};
> 
> int main()
> {
>    allegro_init();
>    polygon(screen, 6, points, 15);
>    getch();

It removes the `const' qualifier from `points' due to prototype.

Look at the prototype of `polygon': I'm guessing that its 3rd
argument's type is `int[]' or `int *'.  But you pass a `const int []'
instead, so the compiler tells you that `polygon' might change its
3rd argument--beware!

- Raw text -


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