Date: Thu, 18 Aug 2005 12:08:50 +0400 From: Sergey Matveychuk <sem@FreeBSD.org> To: Chuck Swiger <cswiger@mac.com> Cc: questions@FreeBSD.org Subject: Re: man malloc Message-ID: <43044212.20909@FreeBSD.org> In-Reply-To: <4303B016.3030201@mac.com> References: <4303A632.1000809@FreeBSD.org> <4303B016.3030201@mac.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Chuck Swiger wrote: >> What does "suitable aligned for storage of *any* type of object" means? > > > On some platforms, it is either desirable or required that, say, a > 8-byte double is stored at a memory location which is is also aligned to > 8-bytes: Oh, it was told for different architectures. It's quite clear for me now. > >> What is pointer coercion? I have no pointer before malloc() returns. > > > Right. Well, malloc returns a (void *), but most people want to use the > memory malloc returns to hold their own arrays, structs, whatever, which > 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. Thanks, guys! -- Sem.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43044212.20909>