[Top][All Lists]

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

Re: [Liberty-eiffel] Warnign about 'const' qualifier

From: Paolo Redælli
Subject: Re: [Liberty-eiffel] Warnign about 'const' qualifier
Date: Wed, 14 Mar 2018 14:49:12 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0

Il 13/03/2018 19:32, Germán Arias ha scritto:

I have a C function like this:

const char* IupConfigGetVariableStr(Ihandle* ih, const char* group,
                                     const char* key);

When I call it from Eiffel I get this warning:

warning: assignment discards ‘const’ qualifier from pointer target type
[enabled by default]

I assign the returned value to a POINTER, and then make a string from
it. It works fine but is there a way to remove this warning?

I was going to write "use FIXED_STRING" which is exactly whay a "const char*" is when dealing with strings but the issue is that POINTER is "void *" and not "const void*" .

Currently you have to cast the type when you declare the feature; a quick (dirty, I admit) hack would be:

feature_name "(void*) IupConfigGetVariableStr"

or define a similar macro in the plugin/c

I'll try as soon as I'm at home this evening.

I suspect that we really need something like "CONST_POINTER"...

reply via email to

[Prev in Thread] Current Thread [Next in Thread]