Missing func body 'func Max' In package math?


In package math line 35, it sounds like a ‘missing function body’ to me.
Could some explain how it works Please?

func Max(x, y float64) float64

func max(x, y float64) float64 {
//implementation details

According to the specs:

A function declaration may omit the body. Such a declaration provides the signature for a function implemented outside Go, such as an assembly routine.

In this case, Max is effectively written as different assembly routines depending on the architecture, for example, amd64: https://golang.org/src/math/dim_amd64.s.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.