On 04/03/2014 02:59 PM, Michal Židek wrote:
Hello,

I was looking at
https://fedorahosted.org/sssd/ticket/2214

I did not know about C being that paranoid with nested
pointers to const data when passed as function arguments (I
probably don't use const as often as I should, so I never bumped
into this problem before).

Good explanation on what the problem is can be found here:
http://c-faq.com/ansi/constmismatch.html

I have searched the web and read some materials on how to solve
this issue, but could not find any elegant solution that
would accept both 'char **' and 'const char **' without
warnings (if you know about some way, please tell me).

Than I tried to turn all the data that we pass as arguments 2 or
3 to these functions into 'const char**', but in many cases
it is not possible and we would have to cast them to const. This
spawns another warning during compilation:

warning: to be safe all intermediate pointers in cast from 'char **' to 'const char **' must be 'const' qualified

Which does not look good as well, so if nobody is against, I will
close the ticket as 'wontfix'.

I had the same problem.
I had to use an ugly workaround:
https://git.fedorahosted.org/cgit/ding-libs.git/tree/collection/collection.c#n2667


Michal
_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/sssd-devel


--
Thank you,
Dmitri Pal

Sr. Engineering Manager IdM portfolio
Red Hat, Inc.

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to