From owner-freebsd-hackers@FreeBSD.ORG Mon Apr 4 18:55:44 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 29DCA16A4CE for ; Mon, 4 Apr 2005 18:55:44 +0000 (GMT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id CBE0A43D45 for ; Mon, 4 Apr 2005 18:55:43 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.13.1/8.13.3) id j34ItcWh003469; Mon, 4 Apr 2005 13:55:38 -0500 (CDT) (envelope-from dan) Date: Mon, 4 Apr 2005 13:55:38 -0500 From: Dan Nelson To: Matt Message-ID: <20050404185538.GB42193@dan.emsphone.com> References: <42518AC9.5070208@comcast.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42518AC9.5070208@comcast.net> X-OS: FreeBSD 5.4-PRERELEASE X-message-flag: Outlook Error User-Agent: Mutt/1.5.8i 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:55:44 -0000 In the last episode (Apr 04), Matt said: > 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. The cdecl command (ports/devel/cutils) is good as decoding stuff like this. Those two lines declare variables that are pointers to functions. $ cdecl explain "int (*if_ioctl) (struct ifnet *, int, caddr_t)" declare if_ioctl as pointer to function (pointer to struct ifnet, int, addr_t) returning int $ cdecl explain "int (*if_watchdog) (int)" declare if_watchdog as pointer to function (int) returning int -- Dan Nelson dnelson@allantgroup.com