Forums

Integer default?

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Integer default?

Postby _Gold_Fish » Wed Jul 07, 2010 11:41 am

I know this is probably already somewhere, but I can't find it, so here goes.
What does int (e.g. when used as List<of int>() ) default to? Is it int32 or int64? Because I received this error earlier today:
Code: Select all
 error: Argument 1 of method "add" expects type int?, but the call is supplying type int64.

As a side note, Cobra dies when I put:
List<of int64>()

As another side note, when I use the "is" statement, it throws an error:
error: The left and right sides of the "is" expression can never be identical because of their types ("int64" and "Type"). Maybe you should try "inherits" instead of "is".

It seems to think that int32 and int64 are identical, is this purposeful on your part?
_Gold_Fish
 
Posts: 18

Re: Integer default?

Postby Charles » Wed Jul 07, 2010 1:15 pm

"int" defaults to "int32". "int64" is definitely a different type. When I create a list of them, it works for me:
class X

def main
t = List<of int64>()
trace t

Can you include code samples for these problems you have? The smaller the better. I'll be able to give you better help.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Integer default?

Postby _Gold_Fish » Wed Jul 07, 2010 3:12 pm

Unfortunately, I deleted the code earlier and just thought I'd ask here.
Oh well, thanks for the clarification!
_Gold_Fish
 
Posts: 18


Return to Discussion

Who is online

Users browsing this forum: No registered users and 79 guests