int64 on 32 bit platforms?

1308 views
Skip to first unread message

John

unread,
Feb 10, 2010, 10:48:48 PM2/10/10
to golang-nuts
Greetings all,

This may be a fairly obvious question, but since Go seems to be quite
clever at circumventing various limitations, I wanted to see what the
bottom line was with this:

Since I have a 64 bit version of Go installed on my 64 bit system,
what happens if you try to use a 64 bit numeric type on a 32 bit
system? Will the compiler complain? Does it allow it, and just use
some clever tricks to contain such a large number? Or is this only a
concern with pointer values?

I'm slightly rusty on some of the finer points of theoretical OS
studies, and architectures.

The answer may cause me to have a "Duh" moment, but bear with me, as
I've been awake for long hours.

Thanks,

John

Russ Cox

unread,
Feb 10, 2010, 11:07:52 PM2/10/10
to John, golang-nuts
int64 is supported on 32-bit platforms.
The generated code is more than the single
instruction it would be on a 64-bit platform
but is reasonably efficient. It's the same thing
that C compilers do to support long long (64-bit)
on 32-bit platforms.

Russ

Reply all
Reply to author
Forward
0 new messages