From owner-freebsd-hackers@FreeBSD.ORG Mon Apr 4 18:47:33 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E7F5A16A4CE for ; Mon, 4 Apr 2005 18:47:33 +0000 (GMT) Received: from delight.idiom.com (delight.idiom.com [216.240.32.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 69B3543D48 for ; Mon, 4 Apr 2005 18:47:31 +0000 (GMT) (envelope-from mwm-dated-1113504448.851708@mired.org) Received: from idiom.com (idiom.com [216.240.32.1]) by delight.idiom.com (Postfix) with ESMTP id DFD4D1F0A66 for ; Mon, 4 Apr 2005 11:47:30 -0700 (PDT) Received: from mired.org (mwm@idiom [216.240.32.1]) by idiom.com (8.12.11/8.12.11) with SMTP id j34IlTOX094954 for ; Mon, 4 Apr 2005 11:47:29 -0700 (PDT) (envelope-from mwm-dated-1113504448.851708@mired.org) Received: (qmail 71649 invoked by uid 1001); 4 Apr 2005 18:47:29 -0000 Received: by guru.mired.org (tmda-sendmail, from uid 1001); Mon, 04 Apr 2005 13:47:28 -0500 (CDT) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16977.35775.940391.458960@guru.mired.org> Date: Mon, 4 Apr 2005 13:47:27 -0500 To: Matt In-Reply-To: <42518AC9.5070208@comcast.net> References: <42518AC9.5070208@comcast.net> X-Mailer: VM 7.17 under 21.4 (patch 16) "Corporate Culture" XEmacs Lucid X-Primary-Address: mwm@mired.org X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`; h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ X-Delivery-Agent: TMDA/1.0.3 (Seattle Slew) From: Mike Meyer X-Mailman-Approved-At: Tue, 05 Apr 2005 11:50:56 +0000 cc: freebsd-hackers@FreeBSD.ORG cc: misc@openbsd.org Subject: Re: C programming question X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2005 18:47:34 -0000 In <42518AC9.5070208@comcast.net>, Matt typed: > I need some help understanding some C code. > > int (*if_ioctl) > (struct ifnet *, int, caddr_t); > > int (*if_watchdog) > (int); > > Can someone break down these declarations (if that's what they are)? Is > this a form of typecasting? Thanks for your help. cdecl (in the ports tree) is your friend: guru% cdecl Type `help' or `?' for help explain int (*if_ioctl)(struct ifnet *, int, caddr_t); declare if_ioctl as pointer to function (pointer to struct ifnet, int, caddr_t) returning int explain int (*if_watchdog)(int); declare if_watchdog as pointer to function (int) returning int Note that the parens around the "pointer to function" part are required: explain int *if_watchdog(int); declare if_watchdog as function (int) returning pointer to int http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information.