Thread (2 messages) 2 messages, 2 authors, 2017-03-08
  • sizeof · Tobin C. Harding <hidden> · 2017-03-07
  • sizeof · Anuz Pratap Singh Tomar <hidden> · 2017-03-08

sizeof

From: Tobin C. Harding <hidden>
Date: 2017-03-07 23:20:37

Question relating to the validity/usefulness of patching calls to sizeof.
From Documentation/process/coding-style.rst
The preferred form for passing a size of a struct is the following:

.. code-block:: c

	p = kmalloc(sizeof(*p), ...);

The alternative form where struct name is spelled out hurts readability and
introduces an opportunity for a bug when the pointer variable type is changed
but the corresponding sizeof that is passed to a memory allocator is not.Is the distinction between 


 Question:

Is a the following a valid/useful patch or just code churn

diff--

- sizeof(struct foo)
+ sizeof(*fp)

---
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help