All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brandon Cheo Fusi <fusibrandon13@gmail.com>
To: Denis Kenzior <denkenz@gmail.com>
Cc: Marcel Holtmann <marcel@holtmann.org>, ell@lists.linux.dev
Subject: Re: [PATCH] ell: Make public headers compilable with C++
Date: Wed, 10 May 2023 16:43:54 +0100	[thread overview]
Message-ID: <CAEVJM+pD_CafRK=B+OXqJZHx-MDz-PsCRDkO43fji1VmZ_cjew@mail.gmail.com> (raw)
In-Reply-To: <517bc712-06cf-98c2-c799-eda3d2a9db36@gmail.com>

Hi Dennis,

Sorry for the delay in responding.

Thanks for pointing that out. Wouldn't it be better to not assume an
array of 6+ bytes and instead
do NULL and size checking in the implementations?

Regards,
Brandon

On Sun, Apr 30, 2023 at 7:24 PM Denis Kenzior <denkenz@gmail.com> wrote:
>
> 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

  reply	other threads:[~2023-05-10 15:44 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
2023-05-10 15:43   ` Brandon Cheo Fusi [this message]
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='CAEVJM+pD_CafRK=B+OXqJZHx-MDz-PsCRDkO43fji1VmZ_cjew@mail.gmail.com' \
    --to=fusibrandon13@gmail.com \
    --cc=denkenz@gmail.com \
    --cc=ell@lists.linux.dev \
    --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.