Date: Thu, 18 Aug 2005 22:17:57 +0400 From: Dmitry Mityugov <dmitry.mityugov@gmail.com> To: Giorgos Keramidas <keramida@ceid.upatras.gr> Cc: questions@freebsd.org Subject: Re: man malloc Message-ID: <b7052e1e05081811172b36182e@mail.gmail.com> In-Reply-To: <20050818125348.GG1282@flame.pc> References: <4303A632.1000809@FreeBSD.org> <4303B016.3030201@mac.com> <43044212.20909@FreeBSD.org> <20050818125348.GG1282@flame.pc>
next in thread | previous in thread | raw e-mail | index | archive | help
On 8/18/05, Giorgos Keramidas <keramida@ceid.upatras.gr> wrote: > On 2005-08-18 12:08, Sergey Matveychuk <sem@freebsd.org> 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"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?b7052e1e05081811172b36182e>