How does one make the wordlength of a return type match the wordlength
of a routine argument, well some member of a tuple which is an argument?
Thanks In Advance - Damian
Consider the following?
// this fails <-----------------!!!!!!
// proc testOfTuple1(b : (int(16), int(16), int(?w))) : real(w)
// this works
proc testOfTuple1(b : (int(16), int(16), int(32))) : real(32)
{
var s, e : int;
var m : int;
(s, e, m) = b;
return (e * m):real(32);
}
// this seems really silly trying to do it this way
// let the return statement imply the return type
// (which is flawed because then the first line of
// the definition does not document the interface)
proc testOfTuple2(b)
{
var s, e : int;
var m : int;
var w : int;
(s, e, m) = b;
w = numBits(b(3).type);
writeln(w);
// this works
return (e * m):real(32);
// this fails <-----------------!!!!!!
// return (e * m):real(w);
}
writeln(testOfTuple1((0:int(16), 10:int(16), 15:int(32))));
writeln(testOfTuple2((0:int(16), 10:int(16), 15:int(64))));
Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037
Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here
Views & opinions here are mine and not those of any past or present employer
------------------------------------------------------------------------------
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users