develooper Front page | perl.perl5.porters | Postings from January 2013

Re: I think b630937 (SvUOK docs) is wrong

Thread Previous | Thread Next
Karl Williamson
January 14, 2013 03:11
Re: I think b630937 (SvUOK docs) is wrong
Message ID:
On 12/24/2012 10:26 PM, bulk88 wrote:
> Karl Williamson wrote:
>> I don't understand most of what you are saying.  I did this because I
>> got burned.  In blead, doing a SvUOK(newSVuv(1)) returns FALSE.  That
>> needs to be either changed or documented.  Investigation showed that
>> it would return TRUE iff the value being stored won't fit in an IV.  I
>> hoped that documenting it might cause people to question the current
>> design.
>> Patches or wording suggestions welcome.
> My wording suggestion.
> ___________________________________________________________
> Returns a boolean indicating whether the SV contains an integer which
> must be interpreted as unsigned. An integer whose value is within the
> range of both an IV and an UV maybe be flagged as either.

What would the implications be of changing the macro to match the prior 
documentation, and return true if it is indeed SvIOK with a positive number?

> ___________________________________________________________
> Another note for nitpicking, none of the *OK macros return booleans (1
> or 0). They return 0 or not 0.  I don't want to say true/false either
> since that means something else in C++. Not sure if its worth correcting
> the "boolean" word or not, or its obvious that you will learn very quick
> to not compare it to 1.

I looked at the code, and the macros I saw returned the result of a 
logical expression, which according to K&R is 0 or 1.  Does your 
compiler not follow that?	

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About