Re: [PATCH] Drop redundant 'const' keyword from object parameters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
        osinfo_install_script_get_config_param(script, "");

        return 0;
}

$ LC_ALL=C g++ $(pkg-config --cflags --libs libosinfo-1.0) ./osinfo.cpp 
./osinfo.cpp: In function 'int main()':
./osinfo.cpp:12:58: error: invalid conversion from 'const OsinfoInstallScript* {aka const _OsinfoInstallScript*}' to 'OsinfoInstallScript* {aka _OsinfoInstallScript*}' [-fpermissive]
         osinfo_install_script_get_config_param(script, "");

In file included from ./osinfo.cpp:6:0:
/usr/include/libosinfo-1.0/osinfo/osinfo_install_script.h:246:27: note:   initializing argument 1 of 'OsinfoInstallConfigParam* osinfo_install_script_get_config_param(OsinfoInstallScript*, const gchar*)'
 OsinfoInstallConfigParam *osinfo_install_script_get_config_param(OsinfoInstallScript *script, const gchar *name);

Christophe

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux