On Wed, Jan 30, 2019 at 4:05 PM 伊藤和也 <[email protected]> wrote:
> : > So in this case below, Is the memory usage "12" bytes in total? (Question > 1) > > var num int32 = 100 >> | | >> 4 bytes + 8 bytes = 12 bytes > > no. the literal "100" has no specific size and is conformed to the target of the assignment (num). so, 4 bytes. > and in this case below, Is the memory usage "16" bytes in total? (Question > 2) > because the integer constant "100" is "8" bytes first then it's converted > to "int32" which is "4" bytes. > > var num int32 = int32(100) >> | | | >> 4 bytes + 4 bytes + 8 bytes = 16 bytes > > no. the literal "100" has no specific size and is conformed to the target of the cast int32(100). so, 4 bytes. -- *Michael T. [email protected] <[email protected]>* -- 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.
