Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #39960

Re: switch is shared declaration

Path csiph.com!news.mixmin.net!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Arne Vajhøj <arne@vajhoej.dk>
Newsgroups comp.lang.java.programmer
Subject Re: switch is shared declaration
Date Sun, 28 May 2023 13:43:52 -0400
Organization A noiseless patient Spider
Lines 26
Message-ID <u503sq$va0v$2@dont-email.me> (permalink)
References <af8aa265-141f-4887-8bae-83a9b2a0f9c1n@googlegroups.com> <u4ve27$3t8pn$1@gwaiyur.mb-net.net> <u4vhsg$sea0$1@dont-email.me>
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 8bit
Injection-Date Sun, 28 May 2023 17:43:54 -0000 (UTC)
Injection-Info dont-email.me; posting-host="b44133095db4622383e5373aef64abf2"; logging-data="1026079"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18jWa1eNCcqgJ+BbKhWQmw6uubUNg9m8v8="
User-Agent Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.1
Cancel-Lock sha1:uaorLHAgxHVbPKvRlfU6YB5oZ+4=
In-Reply-To <u4vhsg$sea0$1@dont-email.me>
Content-Language en-US
Xref csiph.com comp.lang.java.programmer:39960

Show key headers only | View raw


On 5/28/2023 8:36 AM, Eric Sosman wrote:
>> Am 24.05.23 um 14:15 schrieb e.d.pro...@gmail.com:
>>> but this is fine:
>>> switch (1) {
>>> case -1:
>>>    String s;
>>>    break;
>>> case 1:
>>>    s = "1";
>>>    break;
>>> }

> There's really no mystery here at all. What e.d.programmer has
> observed is simply that the block governed by `switch' is just
> like any other block: A declaration within a block has scope
> that runs from the declaration to the block end.  The fact that
> this block is part of a `switch' does not change matters: a
> block is a block is a block.

and case ... break; is not a block.

:-)

Arne

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

switch is shared declaration "e.d.pro...@gmail.com" <e.d.programmer@gmail.com> - 2023-05-24 05:15 -0700
  Re: switch is shared declaration Arne Vajhøj <arne@vajhoej.dk> - 2023-05-24 12:57 -0400
    Re: switch is shared declaration Arne Vajhøj <arne@vajhoej.dk> - 2023-05-24 13:16 -0400
    Re: switch is shared declaration "e.d.pro...@gmail.com" <e.d.programmer@gmail.com> - 2023-05-24 11:05 -0700
      Re: switch is shared declaration Michael Jung <miju@golem.phantasia.org> - 2023-05-28 12:57 +0200
  Re: switch is shared declaration Marcel Mueller <news.5.maazl@spamgourmet.org> - 2023-05-28 13:31 +0200
    Re: switch is shared declaration Eric Sosman <esosman@comcast-dot-net.invalid> - 2023-05-28 08:36 -0400
      Re: switch is shared declaration Marcel Mueller <news.5.maazl@spamgourmet.org> - 2023-05-28 15:16 +0200
        Re: switch is shared declaration Arne Vajhøj <arne@vajhoej.dk> - 2023-05-28 13:42 -0400
      Re: switch is shared declaration Arne Vajhøj <arne@vajhoej.dk> - 2023-05-28 13:43 -0400

csiph-web