Mail Archives: djgpp/2009/03/15/18:45:30
"Jason" <nospam AT net> wrote in message
news:49bce243$0$1116$4fafbaef AT reader3 DOT news DOT tin DOT it...
> when compiling appears an error:
>
> C:\Djgpp\bin>gcc -o Clip.exe Clip.c
> Clipdj.c: In function 'main':
> Clipdj.c:75: warning: passing argument 1 of 'rm_int_es_bx' discards
> qualifiers f
> rom pointer target type
>
There are a few ways to fix this. The issue is "to" isn't a type directly
convertible to a "void *", which is what the first argument of
rm_int_es_bx() requires. This wouldn't have been an issue if "to" was a
"char *" instead of a "static const char *".
For a first solution, you could add a cast on "to" in the rm_int_ex_bx()
call to change it to a "char *" so that it can be converted to a "void *":
> rm_int_es_bx(to, sizeof(to), ®s, 0x2F);
rm_int_es_bx((char *)to, sizeof(to), ®s, 0x2F);
(NOTE: I've put a ">" to indicate the original line of code to distinquish
it from my changes)
For a second solution, you could eliminate the uneeded qualifiers on "to" by
changing this line:
> static const char to[] = "Hello";
char to[] = "Hello";
(NOTE: The qualifiers are uneeded because the buffer "to" will never be
overwritten...)
For a third solution, you could eliminate the use of sizeof() and the
qualifiers on "to" by changing these lines:
#include <stdio.h> /* add */
> static const char to[] = "Hello";
char *to="Hello";
> regs.x.cx = sizeof(to);
regs.x.cx = strlen(to)+1;
> rm_int_es_bx(to, sizeof(to), ®s, 0x2F);
rm_int_es_bx(to, strlen(to)+1, ®s, 0x2F);
(NOTE: Use of sizeof() should be avoided if minor code changes allow use of
strlen() instead.)
HTH,
Rod Pemberton
- Raw text -