The code

x = 5

will produce a variable x of type Int.

Generally it will be safe to write code like

foo(maxiter::Int = 1000) = for i=1:maxiter do_stuff() end

It would be somewhat overkill to define foo(maxiter::Integer) as Julia will
generate not only the method foo(::Int), but also foo(::Int8),
foo(::BigInt) and so on for each subtype of Integer. In this particular
example, one would not expect any of these other methods to ever be used.

If your code needs to assume something about the size of the integer, go
with Int32 or Int64 instead.

Thanks,

Jiahao Chen
Staff Research Scientist
MIT Computer Science and Artificial Intelligence Laboratory

On Mon, Feb 9, 2015 at 4:57 PM, Christoph Ortner <[email protected]
> wrote:

> Thanks for clarifying; so in fact I am using `Int` the wrong way, and
> should normally specify whether I want Int16, Int32, Int64?
>
> Thank you,
>     Christoph
>
>

Reply via email to