odd warning message from gcc under FreeBSD 4.10

Richard Williamson richard.williamson at u4eatech.com
Mon Oct 25 08:20:21 PDT 2004


Hello,

Is this something known about, or: What am I missing?

TIA,
rip

PROBLEM:

man strstr says: returns char *
test code throws warning on line 7:
test.c:7: warning: assignment makes pointer from integer \
       without a cast


TEST CODE
int main (int argc, void ** argv)
{
   char *pBlah = 0x0;
   char rudolph[64] = "Rudolph the Red Nosed Reindeer";
   char red[4] = "Red";

   pBlah = strstr(rudolph, red);

   printf("1: %s\n", rudolph);
   printf("2: %s\n", red);
   printf("3: %s\n", pBlah);
}

TEST COMPILE (linux)
bash-2.05b# gcc -o test test.c
bash-2.05b# uname -a
Linux mir 2.6.8-gentoo-r7 #1 Mon Oct 11 14:18:22 BST 2004 \
i686 Intel(R) Pentium(R) 4 CPU 2.80GHz GenuineIntel GNU/Linux
bash-2.05b# ./test
1: Rudolph the Red Nosed Reindeer
2: Red
3: Red Nosed Reindeer
bash-2.05b#

TEST COMPILE (FreeBSD)
venus 17:11 [~/cassess2] rip>gcc -o test test.c
test.c: In function `main':
test.c:7: warning: assignment makes pointer from integer \
         without a cast
venus 17:11 [~/cassess2] rip>uname -a
FreeBSD venus.degree2.com 4.10-RELEASE FreeBSD 4.10-RELEASE #0: \
            Tue May 25 22:47:12 GMT 2004 
root at perseus.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
venus 17:12 [~/cassess2] rip>./test
1: Rudolph the Red Nosed Reindeer
2: Red
3: Red Nosed Reindeer
venus 17:12 [~/cassess2] rip>


More information about the freebsd-questions mailing list