From owner-freebsd-questions@FreeBSD.ORG Tue Apr 13 09:40:47 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E7DB616A4CE for ; Tue, 13 Apr 2004 09:40:47 -0700 (PDT) Received: from smtp.infracaninophile.co.uk (ns0.infracaninophile.co.uk [81.2.69.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2E60543D2D for ; Tue, 13 Apr 2004 09:40:47 -0700 (PDT) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost.infracaninophile.co.uk [IPv6:::1])i3DGegNE095646 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 13 Apr 2004 17:40:42 +0100 (BST) (envelope-from matthew@happy-idiot-talk.infracaninophile.co.uk) Received: (from matthew@localhost)id i3DGefKn095641; Tue, 13 Apr 2004 17:40:41 +0100 (BST) (envelope-from matthew) Date: Tue, 13 Apr 2004 17:40:41 +0100 From: Matthew Seaman To: Brian Henning Message-ID: <20040413164041.GB94448@happy-idiot-talk.infracaninophile.co.uk> Mail-Followup-To: Matthew Seaman , Brian Henning , freebsd-questions@freebsd.org References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="St7VIuEGZ6dlpu13" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6i X-Spam-Status: No, hits=-4.8 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on happy-idiot-talk.infracaninophile.co.uk X-Virus-Scanned: clamd / ClamAV version devel-20040407, clamav-milter version 0.70g cc: freebsd-questions@freebsd.org Subject: Re: stdio.h X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Apr 2004 16:40:48 -0000 --St7VIuEGZ6dlpu13 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 13, 2004 at 09:45:39AM -0500, Brian Henning wrote: > I have a question about the stdio.h file. >=20 > In the following function signature what does the __P do?=20 >=20 > Why is the __P needed? >=20 > int (*_close) __P((void *)); History. Backwards compatability. This construct dates from the times of K&R C, before the ANSI standard that said function prototypes should contain argument type declarations. If you examine the header file, you'll see that macro is designed to expand to either an empty pair of brackets -- () -- which is the old-style prototype, or the string enclosed within it -- (void *) -- which is the "new" style prototype. I say "new" because prototypes like that have been standard for more than 10 years. On any compiler you encounter nowadays that declaration will be resolved to: int (*_close) (void *) meaning _close is a pointer to a function taking an arbitrary pointer as argument and returning an int. Yes -- the __P() construct is pretty much obsolete nowadays, but it's probably more trouble than it's worth to try and strip it out of everything. Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way PGP: http://www.infracaninophile.co.uk/pgpkey Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK --St7VIuEGZ6dlpu13 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFAfBgJdtESqEQa7a0RAkrZAJ0Z7c5IIY78ofF7u4Bqm7iynkcD2gCfUes1 ApZtrsWa6yFlQymwJsOSHnM= =OLM4 -----END PGP SIGNATURE----- --St7VIuEGZ6dlpu13--