From owner-freebsd-hackers@FreeBSD.ORG Wed Jul 6 18:17:12 2005 Return-Path: X-Original-To: freebsd-hackers@FreeBSD.ORG 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 A342416A41C for ; Wed, 6 Jul 2005 18:17:12 +0000 (GMT) (envelope-from mickey@lucifier.net) Received: from ns.lucifier.net (ns.lucifier.net [66.114.66.53]) by mx1.FreeBSD.org (Postfix) with ESMTP id 19C3643D46 for ; Wed, 6 Jul 2005 18:17:11 +0000 (GMT) (envelope-from mickey@lucifier.net) Received: from mail.lucifier.net (versalo.lucifier.net [66.114.79.48]) by ns.lucifier.net (8.13.1/8.13.1) with ESMTP id j66IH6if025135 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=FAIL); Wed, 6 Jul 2005 14:17:08 -0400 (EDT) Received: from lucifier.net (IDENT:mickey@localhost [127.0.0.1]) by mail.lucifier.net (8.13.4/8.12.10) with ESMTP id j66HuPYo023775 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 6 Jul 2005 13:56:25 -0400 (EDT) Received: (from mickey@localhost) by lucifier.net (8.13.4/8.12.10/Submit) id j66HuKNJ018494; Wed, 6 Jul 2005 13:56:20 -0400 (EDT) From: Michael Shalayeff Message-Id: <200507061756.j66HuKNJ018494@lucifier.net> In-Reply-To: <1120667769.8695.10.camel@localhost.localdomain> from "Juan J. [Mart_nez]" at "Jul 6, 2005 06:36:09 pm" To: "Juan J. [Mart_nez]" Date: Wed, 6 Jul 2005 13:56:20 -0400 (EDT) X-Operating-System: BSD 2.11 X-Flames-To: /dev/null X-Elm-Rules: righton X-Mailer: ELM [version 2.4ME+ PL66 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Thu, 07 Jul 2005 12:09:13 +0000 Cc: freebsd-hackers@FreeBSD.ORG, misc@openbsd.org, Matt Subject: Re: C programming question X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jul 2005 18:17:12 -0000 Making, drinking tea and reading an opus magnum from Juan J. [Mart_nez]: [Charset ISO-8859-1 unsupported, filtering to ASCII...] > El lun, 04-04-2005 a las 11:43 -0700, Matt escribis: > > [...] > > Can someone break down these declarations (if that's what they are)? Is > > this a form of typecasting? Thanks for your help. > > Those are declarations of pointers to functions. > > /* real function */ > void dumb(int a) { return a; } warning: `return' with a value, in function returning void > ... > > /* here follows a declaration of func pointer */ > int (*func_ptr)(int); > int a; > > /* assign it */ > func_ptr=dumb; warning: assignment from incompatible pointer type > /* use it */ > a=func_ptr(123); > > Any good book about C should cover this. Look for OOP in C also, it's > frequent use pointers to functions + structs to add classes to C. perhaps you should read that book first (: cu -- paranoic mickey (my employers have changed but, the name has remained)