From owner-freebsd-questions@FreeBSD.ORG Sat Feb 19 23:07:34 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 806AB16A4CE for ; Sat, 19 Feb 2005 23:07:34 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.194]) by mx1.FreeBSD.org (Postfix) with ESMTP id 17F5E43D2F for ; Sat, 19 Feb 2005 23:07:34 +0000 (GMT) (envelope-from gert.cuykens@gmail.com) Received: by rproxy.gmail.com with SMTP id a41so100162rng for ; Sat, 19 Feb 2005 15:07:33 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=YVgvtrNp97GHwXE32e6SxHKrCOCF+sSBWWdAYuFlMLnnUXQcXzVzXXrC0GMDO53Bh8NICpeTslriru7gekHn67xZw4ckRcoBrn1OCasMpFAdLCGaHDbhx6cYN6mWkYbOEXZTG80BYi2FIsWLkEGzbVGXdc/xe2uP36rUIAyA9ew= Received: by 10.38.81.71 with SMTP id e71mr17106rnb; Sat, 19 Feb 2005 15:07:33 -0800 (PST) Received: by 10.38.74.23 with HTTP; Sat, 19 Feb 2005 15:07:33 -0800 (PST) Message-ID: Date: Sun, 20 Feb 2005 00:07:33 +0100 From: Gert Cuykens To: "Chad Leigh -- Shire. Net LLC" In-Reply-To: <5b8472dd5925a0b0b59f15cd9f8e15f3@shire.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable References: <5b8472dd5925a0b0b59f15cd9f8e15f3@shire.net> cc: freebsd-questions@freebsd.org Subject: Re: c++ X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Gert Cuykens List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Feb 2005 23:07:34 -0000 On Sat, 19 Feb 2005 02:57:53 -0700, Chad Leigh -- Shire. Net LLC wrote: >=20 > On Feb 19, 2005, at 2:51 AM, Gert Cuykens wrote: >=20 > > On Thu, 17 Feb 2005 13:17:51 +0100, Hubert Soko=C5=82owski > > wrote: > >> On Thu, 17 Feb 2005 13:05:43 +0100 > >> Gert Cuykens wrote: > >> > >>> static void callback( GtkWidget *widget, gpointer data ){ > >>> g_print ("Hello again - %s was pressed\n", (gchar *) data); > >>> } > >>> > >>> why do they put () around gchar ? > >>> why can it not be gchar *data ? > >> > >> You should learn some more about programming in C before you start > >> writing GTK apps. > >> > >> hs > > > > Does anybody want to explain what the () thingies are around gchar * ? > > >=20 > It is a typecast -- coercing "data" to be of type (gchar *) to the > compiler when matching parameter types at compiler time. >=20 > Chad >=20 lol :) I wish you could see the expression on my face while reading it :)= =20 Why can i not do this ? g_print ("Hello again - %s was pressed\n", gchar *data); or this gchar *data; g_print ("Hello again - %s was pressed\n", *data); or this gchar *data; g_print ("Hello again - %s was pressed\n", data); What does coercing mean ? Why does the compiler have to match parameters ? PS what is the difference between ? A=3D*data A=3Ddata A=3D&data