On 20/11/2020 17:24, Sebastian Huber wrote:

On 20/11/2020 17:18, Gedare Bloom wrote:

On Fri, Nov 20, 2020 at 6:34 AM Sebastian Huber
<sebastian.hu...@embedded-brains.de> wrote:
On 20/11/2020 14:31, Joel Sherrill wrote:

Wasn't there Doxygen above it?
No.
Needs comments
I think a one liner function with a very descriptive name needs no
comments if it is placed in a source file:

static bool _Partition_Is_buffer_area_aligned( const void
*starting_address )
{
    return ( ( (uintptr_t) starting_address ) % CPU_SIZEOF_POINTER ) == 0;
}
I disagree, this is worth one line to remind that buffers need to be
aligned to a multiple of the pointer size (and are a multiple of the
pointer size).

Just because we can put the code in one line doesn't mean that its
context is clear.

This function is no longer in a header file. It is in a source file right next to the code which calls this function. The function name _Partition_Is_buffer_area_aligned() tells you that the function checks if the buffer area is aligned. The code

( ( (uintptr_t) starting_address ) % CPU_SIZEOF_POINTER ) == 0;

tells you exactly that the address is aligned if and only if it is an integral multiple of the pointer size. Which information is missing which justifies a comment?
This function is only used in one place. So, instead of adding a comment to this function, it makes more sense to remove the function and add a comment to the calling site.

--
embedded brains GmbH
Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
Phone: +49-89-18 94 741 - 16
Fax:   +49-89-18 94 741 - 08
PGP: Public key available on request.

embedded brains GmbH
Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier: 
https://embedded-brains.de/datenschutzerklaerung/

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to