From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp11.infineon.com (smtp11.infineon.com [IPv6:2a00:18f0:1e00:4::5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yH8RJ1NQ7zDrLC for ; Wed, 18 Oct 2017 22:07:39 +1100 (AEDT) From: To: , CC: , , , , , , , , , , , , , , , , , , Subject: RE: char-TPM: Adjustments for ten function implementations Date: Wed, 18 Oct 2017 11:07:35 +0000 Message-ID: <65f6b172844a47c9b0b5ca1bb7ce2ad8@infineon.com> References: <1d3516a2-a8e6-9e95-d438-f115fac84c7f@users.sourceforge.net> <20171016183139.otyh3m5c5yurtmow@linux.intel.com> <20171016183512.3bz6x4b6lbhpbkje@linux.intel.com> <20171017085124.pkrjzghcf5wmcydc@mwanda> <1508255833.3129.33.camel@HansenPartnership.com> <1508280210.6530.32.camel@perches.com> <1508318326.6806.1.camel@perches.com> <026d582729b849b780fbaa06fb8bc79e@infineon.com> <1508323753.6806.5.camel@perches.com> In-Reply-To: <1508323753.6806.5.camel@perches.com> Content-Type: text/plain; charset="Windows-1252" MIME-Version: 1.0 List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , > On Wed, 2017-10-18 at 10:44 +0000, Alexander.Steffen@infineon.com wrote: > > > For instance, nothing about > > > > > sizeof(type) > > > > > vs > > > > > sizeof(*ptr) > > > > > makes it easier for a human to read the code. > > > > > > > > If it does not make it easier to read the code for you, then maybe = you > > > > should consider that this might not be true for all humans. For me,= it > > > > makes it much easier to see at a glance, that code like > > > > ptr=3Dmalloc(sizeof(*ptr)) is correct. > > > > > > I don't think there is a perfect solution. > > > > Maybe. But for the second variant the correctness is easier to check, >=20 > How often should > ptr =3D alloc(sizeof(*ptr)) > be > ptr =3D alloc(sizeof(**ptr)) Never? Because in that case it probably should be *ptr=3Dalloc(sizeof(**ptr= )), unless you are doing something horrible ;-) Alexander