On Wed, Jan 30, 2019 at 4:40 PM 伊藤和也 <[email protected]> wrote:
>
> I thought "100" has a specific size then "num" has the copy of "100".

In a compiled language like Go it's not very useful to think about the
size of numeric constants.  Think about the sizes of variables.
Numeric constants exist only in the instruction stream, and their
representation is processor-dependent.


> So in this case below, "100" is passed to the function "f" is also "4" bytes 
> in total?
>
>> func main() {
>>        f(100)
>> }
>
>
>>
>> func f(num int32) { // num is "4" bytes
>>
>> }

Yes, when the value 100 is passed to f, it is stored into the 4 bytes
of storage used for the parameter num.

Ian

-- 
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