FAQ
The language specification says:

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

I can understand the abs.go list the function as `func Abs(x float64)
float64` without body because there are three files which implemented this
function: abs_386.s, abs_arm.s, abs_amd64.s.

But there is also a function in abs.go with the signature `func abs(x
float64) float64` which is not exported, and I don't know where it is used.

Can someone please explain this for me? Thanks

--
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 golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Angang Guo at Jan 4, 2014 at 6:34 am
    I mean this Go source file from math package:
    https://code.google.com/p/go/source/browse/src/pkg/math/abs.go

    --
    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 golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Andrey mirtchovski at Jan 4, 2014 at 6:42 am
    read the description for the CL that introduced it:

    https://code.google.com/p/go/source/detail?r=af839530a31e

    specifically that assembly implementations for unsupported
    architectures may jump back to the pure go implementation.

    i don't think (only briefly checked) there are any architectures that
    aren't implementing all those basic functions in assembly, but that
    doesn't mean there won't be others in the future.

    --
    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 golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dave Cheney at Jan 4, 2014 at 9:46 am
    Some of the crypto/shaXXX implementations use a pure Go impl for 32bit
    platforms, they could be a good place to look.

    On Sat, Jan 4, 2014 at 5:42 PM, andrey mirtchovski wrote:

    read the description for the CL that introduced it:

    https://code.google.com/p/go/source/detail?r=af839530a31e

    specifically that assembly implementations for unsupported
    architectures may jump back to the pure go implementation.

    i don't think (only briefly checked) there are any architectures that
    aren't implementing all those basic functions in assembly, but that
    doesn't mean there won't be others in the future.

    --
    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 golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    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 golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Caleb Doxsey at Jan 4, 2014 at 11:11 pm
    Here's another example:

    http://golang.org/src/pkg/math/atan2_arm.s

    Go is case sensitive so Abs is different from abs.

    For more info about assembly I have a full walkthrough here:

    http://www.doxsey.net/blog/go-and-assembly

    On Sat, Jan 4, 2014 at 2:46 AM, Dave Cheney wrote:

    Some of the crypto/shaXXX implementations use a pure Go impl for 32bit
    platforms, they could be a good place to look.

    On Sat, Jan 4, 2014 at 5:42 PM, andrey mirtchovski wrote:

    read the description for the CL that introduced it:

    https://code.google.com/p/go/source/detail?r=af839530a31e

    specifically that assembly implementations for unsupported
    architectures may jump back to the pure go implementation.

    i don't think (only briefly checked) there are any architectures that
    aren't implementing all those basic functions in assembly, but that
    doesn't mean there won't be others in the future.

    --
    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 golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    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 golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    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 golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Angang Guo at Jan 6, 2014 at 9:54 pm
    Thank you all for these good explanations. I'm very happy that Golang
    community has so many helpful and kindness experts here to help us.
    On Saturday, January 4, 2014 3:11:35 PM UTC-8, Caleb Doxsey wrote:

    Here's another example:

    http://golang.org/src/pkg/math/atan2_arm.s

    Go is case sensitive so Abs is different from abs.

    For more info about assembly I have a full walkthrough here:

    http://www.doxsey.net/blog/go-and-assembly


    On Sat, Jan 4, 2014 at 2:46 AM, Dave Cheney <da...@cheney.net<javascript:>
    wrote:
    Some of the crypto/shaXXX implementations use a pure Go impl for 32bit
    platforms, they could be a good place to look.


    On Sat, Jan 4, 2014 at 5:42 PM, andrey mirtchovski <mirtc...@gmail.com<javascript:>
    wrote:
    read the description for the CL that introduced it:

    https://code.google.com/p/go/source/detail?r=af839530a31e

    specifically that assembly implementations for unsupported
    architectures may jump back to the pure go implementation.

    i don't think (only briefly checked) there are any architectures that
    aren't implementing all those basic functions in assembly, but that
    doesn't mean there won't be others in the future.

    --
    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 golang-nuts...@googlegroups.com <javascript:>.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    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 golang-nuts...@googlegroups.com <javascript:>.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    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 golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJan 4, '14 at 6:22a
activeJan 6, '14 at 9:54p
posts6
users4
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase