What's new

Compiler warning'''

Slougi

New member
'lo evewybuddy

I have been fudging around with some C again, and get one compiler warning that I just do not comprehend. The warning is thus:

Code:
sxmms.c: In function `xmms':
sxmms.c:18: warning: passing arg 2 of `fseek' makes integer from pointer without a cast
Now I know what the warning means, but not what sets it off. Line 18 looks like this:

Code:
fseek(fp, NULL, SEEK_END);

fp is a file pointer. Now NULL is not a pointer, is it due to that? And if it is, how do I fix the warning?
 

Hacktarux

Emulator Developer
Moderator
fseek(fp, 0, SEEK_END);

the second argument is an offset so it should be a number not a pointer.
 

icepir8

Moderator
NULL is handled differently between C and C++.

In C: NULL is 0.

In C++: NULL is a pointer to 0.
 

Cyberman

Moderator
Moderator
Also C++ has what's termed STRONG type casting so even what one might thing is insignificant can lead to strange errors.

<see one of my prior posts for bizare!>

Cyb
 
OP
S

Slougi

New member
icepir8 said:
NULL is handled differently between C and C++.

In C: NULL is 0.

In C++: NULL is a pointer to 0.
In that case the above would be true though? :confused:
 

euphoria

Emutalk Member
Taken from VC6.0 header
windef.h -- Basic Windows Type Definitions:

#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
 

Top