通过打印函数名称获得的十六进制值代表什么意思?

huangapple go评论80阅读模式
英文:

What does the hexadecimal value obtained by printing the name of a function mean?

问题

在下面的代码中,我创建了两个函数someFunction1someFunction2

package main

import (
	"fmt"
)

func someFunction1() {}
func someFunction2() {}

func main() {
	fmt.Println(someFunction1)	// 0x7de480
	fmt.Println(someFunction2)	// 0x7de4a0
}

通过打印它们,我得到了两个十六进制值0x7de4800x7de4a0。我的问题很简单,这些值代表什么意思?

英文:

In the following code I have created two functions someFunction1 and someFunction2:

package main

import (
	"fmt"
)

func someFunction1() {}
func someFunction2() {}

func main() {
	fmt.Println(someFunction1)	// 0x7de480
	fmt.Println(someFunction2)	// 0x7de4a0
}

By printing them I got two hexadecimal values 0x7de480 and 0x7de4a0. My question is simple, what do these values mean?

答案1

得分: 3

这些十六进制值是函数someFunction1和someFunction2的内存地址。它们表示函数在计算机内存中的位置。这意味着someFunction1存储在内存地址0x7de480,而someFunction2存储在内存地址0x7de4a0。

英文:

These hexadecimal values are the memory addresses of the two functions someFunction1 and someFunction2. They indicate the location of the functions in the computer's memory. This means that someFunction1 is stored at memory address 0x7de480 and someFunction2 is stored at memory address 0x7de4a0.

huangapple
  • 本文由 发表于 2022年12月6日 11:19:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/74696886.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定