From owner-freebsd-questions@FreeBSD.ORG Thu Aug 18 08:07:55 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 797D216A41F for ; Thu, 18 Aug 2005 08:07:55 +0000 (GMT) (envelope-from sem@FreeBSD.org) Received: from mail.ciam.ru (mail.ciam.ru [213.147.57.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id EFB0643D46 for ; Thu, 18 Aug 2005 08:07:54 +0000 (GMT) (envelope-from sem@FreeBSD.org) Received: from [213.85.81.137] (helo=[192.168.0.3]) by mail.ciam.ru with esmtpa (Exim 4.x) id 1E5fRJ-0004Qb-94; Thu, 18 Aug 2005 12:07:53 +0400 Message-ID: <43044212.20909@FreeBSD.org> Date: Thu, 18 Aug 2005 12:08:50 +0400 From: Sergey Matveychuk User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050813) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Chuck Swiger References: <4303A632.1000809@FreeBSD.org> <4303B016.3030201@mac.com> In-Reply-To: <4303B016.3030201@mac.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 08:07:55 -0000 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.