Skip to content

Conversation

jeppenodgaard
Copy link

@jeppenodgaard jeppenodgaard commented Oct 2, 2025

C++20 require that either all initializer clauses should be designated or
none of them should be.

Jeppe Odgaard added 2 commits October 3, 2025 09:50
Run `clang-format` on heap_listener.c and heap_listener.h.

Signed-off-by: Jeppe Odgaard <[email protected]>
C++20 require that either all initializer clauses should be designated or
none of them should be.

Signed-off-by: Jeppe Odgaard <[email protected]>
@jeppenodgaard jeppenodgaard force-pushed the fix/heap_listener_macros branch from 3a4b85a to 8824f4a Compare October 3, 2025 08:52
@jeppenodgaard jeppenodgaard changed the title Fix/heap listener macros heap_listener: only use designated initializer Oct 3, 2025
Copy link

sonarqubecloud bot commented Oct 3, 2025

@jeppenodgaard jeppenodgaard marked this pull request as ready for review October 3, 2025 09:44
@zephyrbot zephyrbot added the area: Base OS Base OS Library (lib/os) label Oct 3, 2025
@dcpleung
Copy link
Member

dcpleung commented Oct 3, 2025

Could you skip the formatting patch? It looks worse and more confusing after.

@jeppenodgaard
Copy link
Author

Could you skip the formatting patch? It looks worse and more confusing after.

Can you be more specific about what you dislike?

Do you prefer

#define HEAP_LISTENER_FREE_DEFINE(name, _heap_id, _free_cb)	   \
	struct heap_listener name = {                                                              \
		.heap_id = _heap_id,                                                                      \
		.event = HEAP_FREE,                                                                      \
		.cb = {                                                                                                \
			.free = _free_cb,                                                                      \
		},                                                                                                        \
	}

?

@dcpleung
Copy link
Member

dcpleung commented Oct 6, 2025

Yeah, that's one.

Another is the if blocks. Currently it is clear and easier to read that there are 3 conditions AND-ed together. After clang-format, a quick skim through the code may skip the second conditon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Base OS Base OS Library (lib/os)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants