[nem-en] conversion of int to uint
Philippe Quesnel
philippe.quesnel at gmail.com
Thu Feb 23 20:56:08 CET 2006
hmmm, this reminds me of a 'Kweztion' / bother I had regarding int / uint.
using System;
class Toto
{
public meth(idx : uint) : int
{
def ss = array[1,2,3,4,5,6];
ss[idx];
}
}
ncc gives me :
t.n:9:9:9:11: error: expected System.UInt32, got int in array index: the
types int and System.UInt32 are not compatible [simple unify]
a) Shouldn't we be able to use uint as an array index !!??
b) isn't the error message 'backwards' ??
expected System.UInt32
got int
I would think it should be : expected int, got uint32 ??
hehe, it looked worse back then because I was then trying to cast:
ss[idx : int]; // this doesn't compile...
oh well, so fall-back on runtime cast :
ss[idx >: int];
doesn't compile ... of course, the op is ':>', not '>:' !!
but since at that point I was having casting problems ;-)
when I got this error :
"t.n:9:12:9:22: error: cannot find the operator `>:' on System.UInt32 and
void -> int"
I didn't realize I was not using the correct operator,
I thought I could not do the cast at all there !! (I get confused easily ;-)
anyways, I thought I'd share this 'story' in case you guys think part of
those 'problems' need to be adressed.
thx
Philippe
On 2/23/06, Valient Gough <valient at gmail.com> wrote:
>
> Hi, I suspect that I've found a bug (in which case I'll put in a bug
> ticket instead). But I wanted to ask first, in case that I'm just
> going about this the wrong way.
>
> I'm having trouble converting from an int to uint. I have to convert
> to a common type because I need to apply a bit-field operation, and
> I'm constrained on the different types from external interfaces.
>
> def checkMask( mask, modes )
> {
>
> }
>
> _______________________________________________
> https://nemerle.org/mailman/listinfo/devel-en
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /mailman/pipermail/devel-en/attachments/20060223/39dac193/attachment.html
More information about the devel-en
mailing list