Path: utzoo!attcan!uunet!lll-winken!ncis.llnl.gov!helios.ee.lbl.gov!pasteur!ucbvax!agate!bionet!csd4.milw.wisc.edu!mailrus!uflorida!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: ANSI C function declaration prototypes Keywords: ANSI, C, functions Message-ID: <9463@smoke.BRL.MIL> Date: 20 Jan 89 20:28:12 GMT References: <1776@edison.GE.COM> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 24 In article <1776@edison.GE.COM> rja@edison.GE.COM (rja) writes: >1) How should I declare a function using prototypes when > that function has no parameters ?? >example: int foo(); That means, in ANSI C, the same as in pre-ANSI C, namely, nothing is specified about the (fixed) number or types of the arguments. What you want in ANSI C is int foo(void); Actually, the form you gave is 100% compatible with this, but it does not allow the compiler to check for correct (empty) usage of the arguments to the function. >2) How should I declare a function which truly returns nothing ? void foo(/*whatever*/); > My first thought was to declare "void foo();" but that still > causes my compiler to warn about a function with no return value > when it compiles the function definition. My guess is that the function definition neglects to specify "void" return type.