char-TPM: Adjustments for ten function implementations

Alexander.Steffen at infineon.com Alexander.Steffen at infineon.com
Wed Oct 18 22:07:35 AEDT 2017


> On Wed, 2017-10-18 at 10:44 +0000, Alexander.Steffen at 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=malloc(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,
> 
> How often should
> 	ptr = alloc(sizeof(*ptr))
> be
> 	ptr = alloc(sizeof(**ptr))

Never? Because in that case it probably should be *ptr=alloc(sizeof(**ptr)), unless you are doing something horrible ;-)

Alexander


More information about the Linuxppc-dev mailing list