On Tue, Feb 21, 2017 at 11:29 PM, andrey mirtchovski
<[email protected]> wrote:
> You can try binary.Size but you'll also run into the same problem:
> int's size is platform specific (binary.Size returns -1 for ints). As
> the go faq states "For portability, code that relies on a particular
> size of value should use an explicitly sized type, like int64."

Actually, for this specific case, there is a very simple method to
compute the size of int at compile time:
https://www.reddit.com/r/golang/comments/4vaaip/number_of_bits_in_an_integer_type/

This is used in strconv/atoi.go.


Manlio

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to