develooper Front page | perl.perl5.porters | Postings from August 2008

Re: [PATCH] 'overloading' pragma

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
August 9, 2008 05:46
Subject:
Re: [PATCH] 'overloading' pragma
Message ID:
20080809124628.GX40282@plum.flirble.org
On Sat, Aug 09, 2008 at 03:40:44PM +0300, Yuval Kogman wrote:

> +	  /* we have an entry in the hints hash, check if method has been
> +	   * masked by overloading.pm */
> +	  const int offset = method / 8;
> +	  const int bit    = method % 7;
> +	  STRLEN len;
> +	  char *pv = SvPV(lex_mask, len);
> +
> +	  if ( len > (STRLEN)offset && pv[offset] & ( 1 << bit ) )
> +	      return NULL;

I wouldn't write that first test that way round. It took me a lot of staring
to realise what it means:

  if ( (STRLEN)offset >= len ) {
      /* Beyond the end, so bit can't be set */
      return NULL;
  }
  if ( pv[offset] & ( 1 << bit ) ) {
      /* Bit set, so this overloading operator is disabled */
      return NULL;
  }

> +print <<"EOF";
> +# -*- buffer-read-only: t -*-
> +#
> +#   overload_numbers.pm
> +#
> +#   Copyright (C) 1997, 1998, 2000, 2001, 2005, 2006, 2007 by Larry Wall
> +#   and others

I think that that should only be the year 2008. Are we copyrighting the file,
or the data it contains?

Nicholas Clark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About