🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1856

Re: prototypes required ?

#1856
From: Doug Gwyn
Date: Thu, 18 Oct 1990 16:48
12 lines
1248 bytes
In article <1964@ccadfa.adfa.oz.au> Christopher-Vance@adfa.oz.au writes:
>gwyn@smoke.BRL.MIL (Doug Gwyn) writes:
>| Yes, you definitely must have a prototype in scope before calling a
>| variable-argument function in a strictly conforming program.
>Which means that gcc -ansi on a Pyramid cannot compile such a thing. I am
>informed that the only way to make printf work is to *omit* the prototype.

As I said before, you should rely on <stdio.h> to properly declare printf().
If <stdio.h> is not included at all, then the C standard guarantees that you
could declare printf() directly in your program, providing that you use the
prototype specified in the standard.  "extern int printf();" on the other
hand has undefined behavior.
Technical Details
Message-ID: <14182@smoke.BRL.MIL>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!sdd.hp.com!uakari.primate.wisc.edu!uflorida!haven!adm!smoke!gwyn
References: <4026@otis.oakhill.UUCP> <14164@smoke.BRL.MIL> <1964@ccadfa.adfa.oz.au>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!sdd.hp.com!uakari.primate.wisc.edu!uflorida!haven!adm!smoke!gwyn
From: gwyn@smoke.BRL.MIL (Doug Gwyn)
Newsgroups: comp.std.c
Subject: Re: prototypes required ?
Keywords: printf stdargs prototypes
Message-ID: <14182@smoke.BRL.MIL>
Date: 18 Oct 90 16:48:04 GMT
References: <4026@otis.oakhill.UUCP> <14164@smoke.BRL.MIL> <1964@ccadfa.adfa.oz.au>
Organization: U.S. Army Ballistic Research Laboratory, APG, MD.
Lines: 12