Closed bubbleguuum closed 4 months ago
Ok I removed it although the proper cast to make the warning go away would have been int (*)( const void*, const void* )
, which I admit is a bit ugly...
Ok I removed it although the proper cast to make the warning go away would have been
int (*)( const void*, const void* )
, which I admit is a bit ugly...
well the function qsort itself it´s ugly, but i don´t recommend casting like you did.
also there´s more suggestions: remove on SC_Data (int ()(void, void*)) cast and add and replace scparser_t on sc_main.h like this:
typedef struct {
const char* token;
int64_t ptroffset;
char type;
} scdatatable_t;
typedef struct {
char token[512];
byte* buffer;
char* pointer_start;
char* pointer_end;
int linepos;
int rowpos;
int buffpos;
int buffsize;
void (*open)(const char*);
void (*close)(void);
void (*compare)(const char*);
int (*find)(boolean);
char(*fgetchar)(void);
void (*rewind)(void);
char* (*getstring)(void);
int (*getint)(void);
int (*setdata)(byte*, const scdatatable_t*);
int (*readtokens)(void);
void (*error)(const char*);
} scparser_t;
byte and void are similar.
also there´s more suggestions: remove on SCData (int ()(void_, void*)) cast and add and replace scparser_t on sc_main.h like
Done.
byte and void are similar.
indeed but GCC (by default, without special flags) issue warnings on pointer function assignments if the signatures do not exactly match. It is a good thing as it allows to catch errors when the function pointers are really not compatible (like the g_demo.c
argument mismatch in the D_MiniLoop
function call that this PR fixes)
All of the warnings fixed by this patch is for gcc
invocation with no special arguments. So these are default warnings.
merged as co-author.
mostly function pointer casts and other benign warnings one warning resulted in fixing inverted function parameters in g_demo.c