2015-08-09 16:46 阅读 13

为什么打包代码没有正文? [重复]

This question already has an answer here:

I wondered coding style of go package when studying exporting packaging.

and found that the code of package in source(ex:"math", "fmt") has

function begins with a capital letter but no body.

I just follow this code but doesn't work.

Anyone who explain why??

func Abs(x float64) float64

func abs(x float64) float64 {
    switch {
    case x < 0:
        return -x
    case x == 0:
        return 0 // return correctly abs(-0)
    return x
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    douyi5822 douyi5822 2015-08-09 16:57

    those functions are implemented in Assembler ( there are platform specific implementations for them: take a look at e.g.:



    func Abs(x float64) float64

    点赞 评论 复制链接分享