FAQ
I'm not sure this is a bug or spec. But sharing information.

http://play.golang.org/p/drX1JPbcgZ

currently, go1.4.2 allows this unused variable.

But gccgo seems not.

https://github.com/mattn/goreman/issues/16

- mattn

--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Jan Mercl at Jul 2, 2015 at 11:52 am

    On Thu, Jul 2, 2015 at 1:35 PM mattn wrote:

    I'm not sure this is a bug or spec.
    From [0]:

    """"
    Implementation restriction: A compiler may make it illegal to declare a
    variable inside a function body
    <http://golang.org/ref/spec#Function_declarations> if the variable is never
    used.
    """"

    IOW, an implementation is free to accept or reject unused variables.

    [0]: http://golang.org/ref/spec#Variable_declarations

    --

    -j

    --
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Russ Cox at Jul 2, 2015 at 2:02 pm

    On Thu, Jul 2, 2015 at 7:35 AM, mattn wrote:

    I'm not sure this is a bug or spec. But sharing information.
    http://play.golang.org/p/drX1JPbcgZ
    currently, go1.4.2 allows this unused variable.
    But gccgo seems not.
    This is a long-standing bug in the gc toolchain. It should be rejecting
    this program too.

    Russ

    --
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedJul 2, '15 at 11:35a
activeJul 2, '15 at 2:02p
posts3
users3
websitegolang.org

3 users in discussion

Russ Cox: 1 post Mattn: 1 post Jan Mercl: 1 post

People

Translate

site design / logo © 2022 Grokbase