From owner-freebsd-questions@FreeBSD.ORG Sun Feb 20 12:47:55 2005 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 C1FA216A4CE for ; Sun, 20 Feb 2005 12:47:55 +0000 (GMT) Received: from mta09-winn.mailhost.ntl.com (smtpout17.mailhost.ntl.com [212.250.162.17]) by mx1.FreeBSD.org (Postfix) with ESMTP id 99CE243D55 for ; Sun, 20 Feb 2005 12:47:54 +0000 (GMT) (envelope-from scott@fishballoon.org) Received: from aamta03-winn.mailhost.ntl.com ([212.250.162.8]) by mta09-winn.mailhost.ntl.com with ESMTP <20050220124753.VTAL29900.mta09-winn.mailhost.ntl.com@aamta03-winn.mailhost.ntl.com>; Sun, 20 Feb 2005 12:47:53 +0000 Received: from llama.fishballoon.org ([82.4.146.133]) by aamta03-winn.mailhost.ntl.com with ESMTP <20050220124753.HPQM9818.aamta03-winn.mailhost.ntl.com@llama.fishballoon.org>; Sun, 20 Feb 2005 12:47:53 +0000 Received: from tuatara.fishballoon.org ([192.168.1.6]) by llama.fishballoon.org with esmtp (Exim 4.43 (FreeBSD)) id 1D2qV4-0002jP-VR; Sun, 20 Feb 2005 12:47:51 +0000 Received: (from scott@localhost) by tuatara.fishballoon.org (8.13.1/8.13.1/Submit) id j1KCloQH000601; Sun, 20 Feb 2005 12:47:50 GMT (envelope-from scott) Date: Sun, 20 Feb 2005 12:47:50 +0000 From: Scott Mitchell To: Gert Cuykens Message-ID: <20050220124749.GA523@tuatara.fishballoon.org> References: <5b8472dd5925a0b0b59f15cd9f8e15f3@shire.net> <675354920.20050220001731@wanadoo.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i X-Operating-System: FreeBSD 4.11-STABLE i386 cc: freebsd-questions@freebsd.org Subject: Re: c++ 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: Sun, 20 Feb 2005 12:47:55 -0000 On Sun, Feb 20, 2005 at 08:41:30AM +0100, Gert Cuykens wrote: > > So if data is declared as a gchar *data; for example, then the value > of data is a memory adress right ? So if A=data; and B=&data; then A > and B are exactly the same result right ? No. A is a 'pointer to gchar' (or gchar*) and B is a 'pointer to pointer to gchar' (or gchar**). The '&data' syntax means 'the address of the data variable', ie. the address of a gchar*, whereas data itself contains the address of a gchar. > Now why would anybody want a gchar when a integer is needed ? That is > just making it more complicated then it already is? Because the code in question deals with gchars (whatever they are) not integers? They won't necessarily be the same thing on different architectures, or even different compilers on the same architecture. Also, the type is called 'gchar' presumably because it logically holds some kind of character data, whereas an integer variable holds an integer. Calling them different things in the code helps to make it clear what the programmer's intention is, even if the two types happen to have the same representation on a given machine/compiler. In any case, this stuff really has nothing to do with FreeBSD - you should be asking these questions in a C/C++ programming group. Cheers, Scott -- =========================================================================== Scott Mitchell | PGP Key ID | "Eagles may soar, but weasels Cambridge, England | 0x54B171B9 | don't get sucked into jet engines" scott at fishballoon.org | 0xAA775B8B | -- Anon