![]() |
#1 |
Knight
Join Date: Jan 2009
Posts: 657
![]() |
Down to a single compiler warning.
Down to a single compiler warning, with VC++ at /W4 when compiling Angband/65. It's a pity that there are some real, game-crashing bugs, but hey! Only one compiler warning
![]() Anyway, that warning is warning C4550: expression evaluates to a function which is missing an argument list for Code:
keypress_h = askfor_aux_keypress; ![]()
__________________
Currently turning (Angband) Japanese. |
![]() |
![]() |
![]() |
#2 |
Swordsman
Join Date: Apr 2007
Posts: 441
![]() |
Does it show in other compilers? It may just be that the people who wrote VCC think you shouldn't be trusted with function pointers.
__________________
One Ring to rule them all. One Ring to bind them.
One Ring to bring them all and in the darkness interrupt the movie. |
![]() |
![]() |
![]() |
#3 | |
Knight
Join Date: Jan 2009
Posts: 657
![]() |
It doesn't on whatever-the-heck gets used in Linux (gcc, I guess).
Quote:
Code:
ang_sort_comp = ang_sort_comp_hook_longs; I can only assume it may have something to do with the weird looking way keypress_h is declared (in the middle of declaring askfor_aux). Code:
extern bool askfor_aux(char *buf, size_t len, bool keypress_h(char *, size_t, size_t *, size_t *, char, bool));
__________________
Currently turning (Angband) Japanese. |
|
![]() |
![]() |
![]() |
#4 | |
Knight
Join Date: Jan 2009
Posts: 657
![]() |
Quote:
Hey, I don't think I should be trusted with function pointers. ![]()
__________________
Currently turning (Angband) Japanese. |
|
![]() |
![]() |
![]() |
#5 |
Rookie
Join Date: Apr 2009
Posts: 13
![]() |
If you change it to:
Code:
(bool *) keypress_h = (bool *) askfor_aux_keypress; |
![]() |
![]() |
![]() |
#6 | |
Knight
Join Date: Jan 2009
Posts: 657
![]() |
Quote:
![]() Code:
warning C4054: 'type cast' : from function pointer 'bool_hack (__cdecl *)(char *,size_t,size_t *,size_t *,char,bool_hack)' to data pointer 'bool_hack *' warning C4054: 'type cast' : from function pointer 'bool_hack (__cdecl *)(char *,size_t,size_t *,size_t *,char,bool_hack)' to data pointer 'bool_hack *' warning C4213: nonstandard extension used : cast on l-value
__________________
Currently turning (Angband) Japanese. |
|
![]() |
![]() |
![]() |
#7 |
Swordsman
Join Date: Apr 2007
Posts: 441
![]() |
I'd worry about that third one. It might be an actual error in some compilers. Don't cast the lvalue at all. Maybe cast the rvalue to a void*?
__________________
One Ring to rule them all. One Ring to bind them.
One Ring to bring them all and in the darkness interrupt the movie. |
![]() |
![]() |
![]() |
#8 |
Prophet
Join Date: Apr 2007
Location: Seattle, WA
Posts: 6,768
Donated: $40
![]() |
The only thing I can think of is that you are overwriting a function argument rather than a local variable. But I don't see why that should make any difference. In any case, that is an absolutely hideous function. What a crazy, 1980's way to turn '*' into a random name.
|
![]() |
![]() |
![]() |
#9 | |
Knight
Join Date: Jan 2009
Posts: 657
![]() |
Quote:
'Cuz the first one's Vanilla Angand and the second one's by Atarlost. ![]()
__________________
Currently turning (Angband) Japanese. |
|
![]() |
![]() |
![]() |
#10 |
Knight
Join Date: Jan 2009
Posts: 657
![]() |
Well I got the answer (from a C programming forum).
In externs.h Code:
extern bool askfor_aux(char *buf, size_t len, bool (*keypress_h)(char *, size_t, size_t *, size_t *, char, bool)); Code:
bool askfor_aux(char *buf, size_t len, bool (*keypress_h)(char *, size_t, size_t *, size_t *, char, bool))
__________________
Currently turning (Angband) Japanese. |
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
VC++ compiler help wanted. | PaulBlay | Development | 6 | April 24, 2009 16:29 |
Link warning | Nick | Development | 12 | April 17, 2009 01:36 |
Help with diving (warning: long) | bebo | Vanilla | 6 | January 22, 2009 02:23 |