delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/05/06:11:00

From: "Newline" <front777 AT hotmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: no warning without #include
Date: Sat, 5 Feb 2000 11:43:43 +0100
Organization: Belgacom Skynet SA/NV
Lines: 42
Message-ID: <87gugg$gpe$1@news0.skynet.be>
NNTP-Posting-Host: dialup175.leuven.skynet.be
X-Trace: news0.skynet.be 949747024 17198 195.238.16.175 (5 Feb 2000 10:37:04 GMT)
X-Complaints-To: abuse AT skynet DOT be
NNTP-Posting-Date: 5 Feb 2000 10:37:04 GMT
X-Newsreader: Microsoft Outlook Express 4.72.3110.1
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi,

I have code :

#include <stdio.h>

int main(void)
{
 char a[50];

 strcpy(a,"something");
 printf("%s\n",a);

 return 0;
}

So i used the strcpy function but not included <string.h>. When i compile
this with DJGPP gcc
I'm not able to get any warning that I didn't include string.h. Why is this
?
(I used 'gcc -c test.c -o test.o -Wall' to compile)

When I replace

strcpy(a,"something");

by

stupid_name(a,"something");

gcc gives me indeed the warning of implicit declared function.

also if I keep strcpy but change the type of a to eg an int, the compiler
also warns me about incompatible types.

So to me it sems as if the compiler knows of the type of strcpy even without
<string.h>

Can someone explain ?



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019