On 7 May 2013 11:09, demerphq <demerphq@gmail.com> wrote: > On 7 May 2013 11:07, Nicholas Clark <nick@ccl4.org> wrote: >> On Tue, May 07, 2013 at 11:02:08AM +0200, demerphq wrote: >>> On 7 May 2013 10:55, Nicholas Clark <nick@ccl4.org> wrote: >> >>> >> Can anybody replicate this? >>> > >>> > Util.xs: In function 'void XS_Hash__Util_hash_traversal_mask(CV*)': >>> > Util.xs:94: error: invalid conversion from 'const HV*' to 'HV*' >>> > Util.xs:94: error: initializing argument 1 of 'void Perl_hv_rand_set(HV*, U32)' >>> > make[1]: *** [Util.o] Error 1 >>> > make[1]: Leaving directory `/home/nick/Perl/perl/ext/Hash-Util' >>> > Unsuccessful make(ext/Hash-Util): code=512 at make_ext.pl line 490. >>> > make: *** [lib/auto/Hash/Util/Util.so] Error 2 >>> > >>> > It's passing a const HV* pointer to a function taking HV* >>> > >>> > if (SvROK(rhv) && SvTYPE(SvRV(rhv))==SVt_PVHV && !SvMAGICAL(SvRV(rhv))) { >>> > const HV * const hv = (const HV *) SvRV(rhv); >>> > if (items>1) { >>> > hv_rand_set(hv, SvUV(ST(1))); >>> > >>> > >>> > I don't know if the right fix is to change that line from 'const HV * const hv' >>> > or to change Perl_hv_rand_set to take a const HV * parameter. >>> >>> Thanks a lot, I eventually figured that out from one of Georges smoke >>> reports which made it easier to see. >>> >>> I was just doing a local build/test on the former. I see no reason not >>> to use the latter, do you perchance know which is "better"? >> >> I *think* that >> >> a) having const pointers is better than non-const pointers >> but only if the 'const' is telling the truth >> (because it gives the compiler more opportunities at the call site) >> b) In this case one can't make Perl_hv_rand_set() take a const HV *, >> because it calls Perl_hv_iterinit(), and *that* potentially modifies >> the (top level) HV struct. >> >> So that leaves only one possible answer :-) >> The one you're already doing. >> >> (And yes, this means that I've thought a bit further since my previous e-mail) > > Your mail arrived just as I was typing: > > " > If I change Perl_hv_rand_set() to take a const HV* then I get further > moans from hv_auxinit(). > > Also, *all* of the other hash functions take a non-const HV parameter, > and it feels weird making this new one the odd man out. Maybe we > should look into that for next release cycle? > " > > So I think we are on the same page here. :-) > > Thanks for the support Nicholas! Dennis changed the Jenkins config to not do parallel builds and I can now see what I did wrong. Fixing. Yves -- perl -Mre=debug -e "/just|another|perl|hacker/"Thread Previous | Thread Next