[SSSD] SSSD ticket #2214

Pavel Reichl preichl at redhat.com
Fri Apr 4 22:30:40 UTC 2014


Or you could write a wrapper function 'diff_string_lists_const' calling original 'diff_string_lists' but at least hiding the nasty discard_const_p.

----- Original Message -----
From: "Dmitri Pal" <dpal at redhat.com>
To: sssd-devel at lists.fedorahosted.org
Sent: Friday, April 4, 2014 11:57:47 PM
Subject: Re: [SSSD] SSSD ticket #2214

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 at 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 at lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/sssd-devel



More information about the sssd-devel mailing list