Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making Go compiler use int64 by default

Tags:

numbers

go

Is there any way I can make the Go compiler use int64 by default on my system? I am writing code for project Euler on my 64 bit machine. There is little chance the code would be shared so there is no worry about running it on a 32 bit machine.

like image 603
cobie Avatar asked Dec 17 '12 17:12

cobie


1 Answers

The int type in go will be 64bits on 64bit machines in the next release, version 1.1. If you download the latest development code you can use it now.

There is no way to force int to be a certain size. However, when you use int you should never assume a particular size. Instead, explicitly type your numbers as int64.

like image 128
Stephen Weinberg Avatar answered Oct 10 '22 18:10

Stephen Weinberg