All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: Brandon Cheo Fusi <fusibrandon13@gmail.com>, marcel@holtmann.org
Cc: ell@lists.linux.dev
Subject: Re: [PATCH] ell: Make public headers compilable with C++
Date: Sun, 30 Apr 2023 13:13:09 -0500	[thread overview]
Message-ID: <517bc712-06cf-98c2-c799-eda3d2a9db36@gmail.com> (raw)
In-Reply-To: <20230428122025.117834-1-fusibrandon13@gmail.com>

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

  parent reply	other threads:[~2023-04-30 18:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-28 12:20 [PATCH] ell: Make public headers compilable with C++ Brandon Cheo Fusi
2023-04-28 16:08 ` James Prestwood
2023-04-30 18:13 ` Denis Kenzior [this message]
2023-05-10 15:43   ` Brandon Cheo Fusi
2023-05-22 14:34     ` Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=517bc712-06cf-98c2-c799-eda3d2a9db36@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ell@lists.linux.dev \
    --cc=fusibrandon13@gmail.com \
    --cc=marcel@holtmann.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.