[Monetdb-developers] [Monetdb-checkins] MonetDB5/src/modules/kernel batcalc.mx, , 1.152, 1.153

Stefan Manegold Stefan.Manegold at cwi.nl
Mon Jul 28 09:23:14 CEST 2008


On Mon, Jul 28, 2008 at 06:10:05AM +0000, Martin Kersten wrote:
> Update of /cvsroot/monetdb/MonetDB5/src/modules/kernel
> In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv6684/kernel
> 
> Modified Files:
> 	batcalc.mx 
> Log Message:
> Oid unary accums are limited to '+'

Since there is IMHO no unary '+' operator defined in MAL, this is unused
("dead") code.
(In fact, I could not tell what the purpose/semantic of a unary '+' operator
should be...)

Moreover, the current code (for good?) also disables unary "--" & "++" for
type OID; hence, the current code is equivalent to a simple
" case TYPE_oid: throw(MAL, "batcalc. at 1", "unexpected operator"); break;"
and could/should be simplified like this.

In fact, the part of the code that has been modified, i.e., the
"CMDunaryAccum at 1" functions, are not used at all, yet, only the
"CMDunary at 1" are used, but is actually the one that triggers
".\..\..\..\..\src\modules\kernel\batcalc.mx(923) : warning C4146: unary minus operator applied to unsigned type, result still unsigned"

I'd suggest to disable (remove?) the unused ("dead") code fo not (yet?) used
"CMDunaryAccum at 1" and cleanup / simplify the code for "CMDunary at 1" as
suggested above.

Stefan

> U batcalc.mx
> Index: batcalc.mx
> ===================================================================
> RCS file: /cvsroot/monetdb/MonetDB5/src/modules/kernel/batcalc.mx,v
> retrieving revision 1.152
> retrieving revision 1.153
> diff -u -d -r1.152 -r1.153
> --- batcalc.mx	21 Jul 2008 09:28:55 -0000	1.152
> +++ batcalc.mx	28 Jul 2008 06:10:02 -0000	1.153
> @@ -937,10 +937,22 @@
>  
>  	switch(BATttype(bn)){
>  	case TYPE_oid: if (  strcmp("@2","+")== 0){
> -				@:accumUnary(oid, at 2)@ 
> -			} else
> -				throw(MAL, "batcalc. at 1", "unexpected operator");
> -			break;
> +			oid* p = (oid*)Tloc(b,BUNfirst(b));
> +			oid *q = (oid*)Tloc(b,BUNlast(b));
> +			oid *o = (oid*)Tloc(bn,BUNfirst(bn));
> +
> +			for(; p<q; p++, o++){
> +				/* this code is better as x?nil:y  */
> +#ifdef NULLTST
> +				if(*p == oid_nil )
> +					*o = oid_nil;
> +				else 
> +#endif
> +					*o = *p;
> +			}
> +		} else
> +			throw(MAL, "batcalc. at 1", "unexpected operator");
> +		break;
>  	case TYPE_bte: @:accumUnary(bte, at 2)@ break;
>  	case TYPE_sht: @:accumUnary(sht, at 2)@ break;
>  	case TYPE_int: @:accumUnary(int, at 2)@ break;
> 
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Monetdb-checkins mailing list
> Monetdb-checkins at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/monetdb-checkins
> 
> 
> 

-- 
| Dr. Stefan Manegold | mailto:Stefan.Manegold at cwi.nl |
| CWI,  P.O.Box 94079 | http://www.cwi.nl/~manegold/  |
| 1090 GB Amsterdam   | Tel.: +31 (20) 592-4212       |
| The Netherlands     | Fax : +31 (20) 592-4312       |




More information about the developers-list mailing list