Mail Archives: djgpp/2002/02/02/08:51:58
> 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 -