Re: [PATCH] ell: Make public headers compilable with C++
Denis Kenzior <[email protected]> Sun, 30 Apr 2023 13:13:09 -0500
| Newsgroups | dev.linux.lists.ell |
|---|---|
| Message-ID | <[email protected]> |
Hi Brandon, On 4/28/23 07:20, Brandon Cheo Fusi wrote: > This patch allows ell/ell.h to be included in C++ code by removing > 'only C' features. These comprise > > i) implicit casts from void* to other types which are now made > explicit > ii) C99 Static array indices. <snip> > bool l_icmp6_client_set_address(struct l_icmp6_client *client, > - const uint8_t addr[static 6]); > + const uint8_t addr[]); You can't really do that because l_icmp6_client_set_address implementation doesn't do any NULL/size checking. It assumes an array of 6+ bytes. And that is sort of the whole point of using the 'static 6' syntax. Maybe there's a way to come up with an alternative declaration, using '__attribute__ nonnull'? Perhaps combined with using a pointer to an array? > uint32_t l_rtnl_set_mac(struct l_netlink *rtnl, int ifindex, > - const uint8_t addr[static 6], > + const uint8_t addr[], > bool power_up, > l_netlink_command_func_t cb, > void *user_data, Same comments here. Regards, -Denis