Yes. Now you can answer this question when the next person asks.
On Wed, Jan 30, 2019 at 10:56 PM 伊藤和也 wrote:
> OK, I want to make it clearer.
>
> Whether constants are untyped or typed, constants are treated at compile
> time and originary there is no idea of how much memory constants take but
OK, I want to make it clearer.
Whether constants are untyped or typed, constants are treated at compile
time and originary there is no idea of how much memory constants take but
there is the idea of how much memory variables take so I should just focus
on how much memory variables take at runt
Quoting Michael Jones (2019-01-30 23:15:51)
>very close. One more idea: typed constants only exist during
>compilation.
I assume you meant "untyped constants" here.
But yes, exactly.
-Ian
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
very close. One more idea: typed constants only exist during compilation.
In the generated executable they are all typed because they have been used
somewhere and that defined their size and type (int, float, ...)
On Wed, Jan 30, 2019 at 6:55 PM 伊藤和也 wrote:
> OK, I understand it somehow but I wa
OK, I understand it somehow but I want to make sure my understanding is
correct.
There are two types of constant "untyped constant" and "typed constant".
1. An untyped constant has a size but it's not specific which means an
untyped constant takes some memory.
> fmt.Println(100)
2. A typed c
On Wed, Jan 30, 2019 at 4:40 PM 伊藤和也 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 instruct
I thought "100" has a specific size then "num" has the copy of "100".
var num int32 = 100
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
>
> }
2019年1月31日木曜日 9時05