🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #52195

Re: Unclear GCC Warning: Implicit Declaration !?

#52195
From: Michael R Castle
Date: Mon, 18 Jan 1993 11:44
39 lines
2572 bytes
In article <lauten.727351645@Physik.TU-Muenchen.DE> lauten@Physik.TU-Muenchen.DE (Markus Lautenbacher) writes:
>--------
>w.c: In function `main':
>w.c:5: warning: implicit declaration of function `printf'
>--------
>
>I thought by writing "#include <stdio.h>" I have already taken care of
>the proper declaration of printf() !?
>Any hints whether I have missed something or whether gcc is incorrect
>here are welcome. Should I care about the warning at all ?

man pages on neither our local next boxes nor ibm pc/rt's list a return
type for printf (therefore, will default to type int).  In my (extremely
limited) experience, some compiler installations don't bother prototyping
functions that return int.  (Also, I believe a function, by default, is
assumed to have at one or more argurments, ala printf, so no need to
prototype there either).  If gcc is installed to use the default 
include files and libraries, it's quite possible that the orginal stdio.h
file didn't have a prototype for printf().  Should be fairly easy to 
grep the file looking for it.  

I believe that the gnu library (well, I guess stdio is really UCB)
includes prototypes for printf() and relatives.

btw, my turbo-c manual lists the return value for printf (of type int)
to represent the number of bytes output to the stream.  Is this 
standard on unix machines? (Neither of the man pages mentioned any
thing about it).

hope this answers your question.  Moreover, I hope it makes sense, 
as it's 5:45am and I'm not just getting up :->

regards,
mrc
-- 
Mike Castle .-=NEXUS=-.  Life is like a clock:  You can work constantly
  mcastle@cs.umr.edu     and be right all the time, or not work at all
S087891@UMRVMA.UMR.EDU   and be right at least twice a day.  -- mrc
    We are all of us living in the shadow of Manhattan.  -- Watchmen
Technical Details
Message-ID: <1993Jan18.114443.4048@umr.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!usenet-feed.cc.umr.edu!mcastle
References: <lauten.727351645@Physik.TU-Muenchen.DE>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,37e0aabd747ee6ab
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-01-19 01:29:59 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!usenet-feed.cc.umr.edu!mcastle
From: mcastle@cs.umr.edu (Michael R Castle)
Subject: Re: Unclear GCC Warning: Implicit Declaration !?
References: <lauten.727351645@Physik.TU-Muenchen.DE>
Date: Mon, 18 Jan 1993 11:44:43 GMT
Nntp-Posting-Host: next9.cs.umr.edu
Organization: University of Missouri - Rolla, Rolla, MO
Keywords: printf implicit declaration
Sender: cnews@umr.edu (UMR Usenet News Post)
Message-ID: <1993Jan18.114443.4048@umr.edu>
Lines: 39