From owner-freebsd-questions@FreeBSD.ORG Thu Aug 18 18:17:59 2005 Return-Path: X-Original-To: questions@freebsd.org 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 7D02D16A41F for ; Thu, 18 Aug 2005 18:17:59 +0000 (GMT) (envelope-from dmitry.mityugov@gmail.com) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.197]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0518643D49 for ; Thu, 18 Aug 2005 18:17:58 +0000 (GMT) (envelope-from dmitry.mityugov@gmail.com) Received: by wproxy.gmail.com with SMTP id i4so420220wra for ; Thu, 18 Aug 2005 11:17:58 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=f+A8jnjJOhCupC3b4dkZbfMxVWe3iU56REWf9vSIUzNtKNYXxl/gJvFiW7mYfV5oMuXNMZ1SxicR9J5d46MQXpThRPiPQ2aU/nJHhpGXydZEm5wwUTsZugtpwv3vi9NmbPvHJIzErbx2ksaqs7dtupHAMlnqqvQzVHKCeMXD2yY= Received: by 10.54.94.1 with SMTP id r1mr814938wrb; Thu, 18 Aug 2005 11:17:57 -0700 (PDT) Received: by 10.54.56.33 with HTTP; Thu, 18 Aug 2005 11:17:57 -0700 (PDT) Message-ID: Date: Thu, 18 Aug 2005 22:17:57 +0400 From: Dmitry Mityugov To: Giorgos Keramidas In-Reply-To: <20050818125348.GG1282@flame.pc> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <4303A632.1000809@FreeBSD.org> <4303B016.3030201@mac.com> <43044212.20909@FreeBSD.org> <20050818125348.GG1282@flame.pc> Cc: questions@freebsd.org Subject: Re: man malloc X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2005 18:17:59 -0000 On 8/18/05, Giorgos Keramidas wrote: > On 2005-08-18 12:08, Sergey Matveychuk wrote: > >Chuck Swiger wrote: > >>>What is pointer coercion? I have no pointer before malloc() returns. > >> > >> Right. Well, malloc returns a (void *), but most people want to use t= he > >> memory malloc returns to hold their own arrays, structs, whatever, whi= ch > >> means that you need to be able to coerce the (void *) malloc gave you > >> into whatever pointer type you want to actually use. > >> > >> So the memory malloc gives you needs to be aligned so that it's OK to = be > >> used for even the most restrictive datatype known to the system, > >> commonly 8, 16, or 32 bytes. > > > > Pointer coercion means a type cast? I see now. > > I read it as 'force change of pointer value' before. >=20 > It may be surprising, but casting back and forth *MAY* change the value > of the pointer. ... Could you back up this assertion with an example, please? --=20 Dmitry Mityugov, St. Petersburg, Russia I ignore all messages with confidentiality statements "We live less by imagination than despite it" - Rockwell Kent, "N by E"