Thread (17 messages) 17 messages, 6 authors, 2017-10-18

Re: char-TPM: Adjustments for ten function implementations

From: Joe Perches <joe@perches.com>
Date: 2017-10-18 10:49:27
Also in: kernel-janitors, linuxppc-dev, lkml

On Wed, 2017-10-18 at 10:44 +0000, Alexander.Steffen@infineon.com wrote:
quoted
For instance, nothing about
quoted
quoted
	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))
 both mentally and programmatically, because there is no need for any context (the type of ptr does not matter).
Context matters.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help