function pointer assignment warnings in VC2005
The latest Micrsoft compilers complain when a function is
assigned to a function pointer, and the function's argument
list does not match the prototype precisely.
It was evem complaining about the difference between this:
int x()
{
[...]
}
and a prototype of
int x(void);
when assigning that function's address to a function pointer.
This quiets those warnings, without suppressing the mismatch
check altogether for more serious mismatches.
This commit is contained in:
@@ -120,6 +120,24 @@ typedef xchar boolean; /* 0 or 1 */
|
||||
#define MONST_P struct monst*
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) && defined(_MSC_VER)
|
||||
/* Microsoft Visual C 2005 (_MSC_VER > 1000) complains if a
|
||||
* function pointer prototype is
|
||||
* int x(void);
|
||||
* via the NDECL macro, but the actual function assigned has a definition
|
||||
* int x()
|
||||
* {
|
||||
* }
|
||||
* We can quiet this by changing the function definition like so
|
||||
* int x(VOID_ARGS)
|
||||
* {
|
||||
* }
|
||||
*/
|
||||
#define VOID_ARGS void
|
||||
#else
|
||||
#define VOID_ARGS
|
||||
#endif
|
||||
|
||||
#define SIZE(x) (int)(sizeof(x) / sizeof(x[0]))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user