[Libosinfo] [PATCH] Drop redundant 'const' keyword from object parameters
Daniel P. Berrange
berrange at redhat.com
Fri Nov 17 11:10:08 UTC 2017
On Thu, Nov 16, 2017 at 10:16:22AM +0100, Christophe Fergeau wrote:
> Hey,
>
> On Sun, Nov 12, 2017 at 05:04:19PM +0100, Zeeshan Ali wrote:
> > Use of 'const' parameter on object parameters is redundant, inconsistent
> > (both internally and against other GObject libraries) and currently breaks
> > the low-level Rust binding generator:
> >
> > https://github.com/gtk-rs/glib/pull/249
>
> Could the Rust binding generator be fixed to cope with that instead?
> It's definitely not used consistently, but removing a 'const' from
> external API is going to cause breakage in C++ code:
>
> extern "C" {
> #include <osinfo/osinfo_datamap.h>
> #include <osinfo/osinfo_entity.h>
> #include <osinfo/osinfo_install_config.h>
> #include <osinfo/osinfo_install_config_paramlist.h>
> #include <osinfo/osinfo_install_script.h>
> }
>
> int main(void)
> {
> const OsinfoInstallScript *script;
The question is whether any C++ app will have actually declared it 'const'
in the first place. I venture to suggest that most would have just don
OsinfoInstallScript *script;
since, that's what they need todo for all other APIs in libosinfo anyway.
That way works both before & after this patch. So we're it won't break
all C++ programs, only a small subset.
IOW instead of breaking 0 users, this change will break 0 users (for a
smaller value of 0 )
> osinfo_install_script_get_config_param(script, "");
>
> return 0;
> }
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
More information about the Libosinfo
mailing list