[Libosinfo] [PATCH] Drop redundant 'const' keyword from object parameters

Christophe Fergeau cfergeau at redhat.com
Fri Nov 17 13:09:52 UTC 2017


On Fri, Nov 17, 2017 at 12:26:48PM +0100, Zeeshan Ali (Khattak) wrote:
> On 17 November 2017 at 12:21, Daniel P. Berrange <berrange at redhat.com> wrote:
> > On Fri, Nov 17, 2017 at 11:57:29AM +0100, Christophe Fergeau wrote:
> >> Hey,
> >>
> >> > > It's definitely not used consistently, but removing a 'const' from
> >> > > external API is going to cause breakage in C++ code:
> >> >
> >> > Well that's true but IMHO this breakage is OK, given:
> >> >
> >> > * the unlikelyhood of an existing C++ project using libosinfo.
> >>
> >> This patch would fix generation of rust bindings, which have 0 users
> >> for sure at the moment since it's broken. So there are at least as many
> >> C++ projects using libosinfo, maybe more :)
> >> If the breakage is fixed in the Rust binding generator soon, I'd rather
> >> we drop this patch.
> >
> > I'm on the fence, but I think on balance i'm slightly in favour of  taking
> > in the patch. It doesn't change ABI, only API so it would only be source
> > level incompatible. Even then its only incompatible if the dev actually
> > declared the variable const, which is about as likely as someone using
> > C++ in the first place.
> 
> Moreover, it's super trivial fix for the build of C++ code. Does that
> fact help you cross the fence? :)

If you go the ugly way (add a cast from const to non-const), then yes
it's probably trivial to change. If you want to do things properly, then
I would not call it "super trivial"

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libosinfo/attachments/20171117/4dbf6faf/attachment.sig>


More information about the Libosinfo mailing list