|
-
GCC Warnings for built-in functions (C)
I don't know if this happens with other compilers (all I use is GCC), but it seems kinda strange to me. I just wrote a function (strend()). Inside that function, I called my own version of strlen(). I did not #include <string.h> anywhere in the program, so it wouldn't be a problem. (It wouldn't be a problem even if I did include <string.h>, would it?) Anyway, when I compile it, GCC gives me this warning:
warning: conflicting types for built-in function 'strlen'
Is this normal? Why would this happen? Oh, and I put main(), strend(), and strlen() all in their own separate files, if that makes a difference.
-
What version of GCC?
------------------
Advocate of the Sharky (Ultra) High-Resolution Club [SHRC]
main(i){putchar(341513875>>(i-1)*5&31|!!(i<6)<<6)&&main(++i);}
Advocate of the Sharky (Ultra) High-Resolution Club [SHRC]
main(i){putchar(341513875>>(i-1)*5&31|!!(i<6)<<6)&&main(++i);}
-
I'll check the version tomorrow, since I'm in Windows now and I just want to get to bed. =)
Anyway, now I'm wondering if GCC even cares about #includes. It seems to me that you have to specify (at the command line) every file that you want to include anyway. (some are always included by default?)
-
Originally posted by Strogian:
I don't know if this happens with other compilers (all I use is GCC), but it seems kinda strange to me. I just wrote a function (strend()). Inside that function, I called my own version of strlen(). I did not #include <string.h> anywhere in the program, so it wouldn't be a problem. (It wouldn't be a problem even if I did include <string.h>, would it?) Anyway, when I compile it, GCC gives me this warning:
warning: conflicting types for built-in function 'strlen'
Is this normal? Why would this happen? Oh, and I put main(), strend(), and strlen() all in their own separate files, if that makes a difference.
It may be that you've altered the original declaration of strlen. The correct prototype should be something like:
size_t strlen( const char * );
where size_t is typically an unsigned int or unsigned long.
The best and safest way to clear the warning message is to either rename your version of strlen to avoid conflict, or to use the C++ namespace feature.
[This message has been edited by Conrad Song (edited June 25, 2001).]
-
Originally posted by Strogian:
I don't know if this happens with other compilers (all I use is GCC), but it seems kinda strange to me. I just wrote a function (strend()). Inside that function, I called my own version of strlen(). I did not #include <string.h> anywhere in the program, so it wouldn't be a problem. (It wouldn't be a problem even if I did include <string.h>, would it?) Anyway, when I compile it, GCC gives me this warning:
warning: conflicting types for built-in function 'strlen'
Is this normal? Why would this happen? Oh, and I put main(), strend(), and strlen() all in their own separate files, if that makes a difference.
Incidentally, just because string.h is not included does not mean that strlen is not defined. Be careful.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|