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


Groups > comp.lang.c++ > #86972

Re: creating a new local variable after a goto

From Manfred <noname@add.invalid>
Newsgroups comp.lang.c++
Subject Re: creating a new local variable after a goto
Date 2022-10-15 01:56 +0200
Organization Aioe.org NNTP Server
Message-ID <ticsvq$ib3$1@gioia.aioe.org> (permalink)
References <ti7u75$1n58g$1@dont-email.me> <87zge0jumy.fsf@bsb.me.uk> <tiaj4l$20k7r$2@dont-email.me> <tiak1v$20os0$1@dont-email.me> <tiam0c$20k7r$3@dont-email.me>

Show all headers | View raw


On 10/14/2022 5:45 AM, Lynn McGuire wrote:
> On 10/13/2022 10:11 PM, Chris M. Thomasson wrote:
>> On 10/13/2022 7:56 PM, Lynn McGuire wrote:
>>> On 10/12/2022 9:59 PM, Ben Bacarisse wrote:
>>>> Lynn McGuire <lynnmcguire5@gmail.com> writes:
>>>>
>>>>> So, I created a new local variable after a goto:
>>>>>
>>>>>     if (crashed)
>>>>>         goto L99999;
>>>>>
>>>>>     std::string msg;
>>>>>
>>>>> Visual C++ 2015 then informed me that "initialization of 'msg' is
>>>>> skipped by 'goto L99999'".
>>>>>
>>>>> Is this a real thing, no variable with a constructor can be created
>>>>> after a goto ?
>>>>
>>>> You can't have a goto and a matching label that might skip over an
>>>> initialisation.  The same applies to non-constructed POD types too.
>>>
>>> Thanks !
>>>
>>> What is a POD type ?
>>
>>
>> Plain Old Data. Iirc, there is a way to test for it:
>>
>> https://en.cppreference.com/w/cpp/types/is_pod
> 
> Thanks !
> 
> And that method is deprecated already.
> 
> Lynn

Here's the cppreference link to the properties that have been mentioned:
https://en.cppreference.com/w/cpp/language/classes#Properties_of_classes
https://en.cppreference.com/w/cpp/language/classes#POD_class

Back to comp.lang.c++ | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

creating a new local variable after a goto Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-12 21:47 -0500
  Re: creating a new local variable after a goto Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-10-13 03:59 +0100
    Re: creating a new local variable after a goto Andrey Tarasevich <andreytarasevich@hotmail.com> - 2022-10-12 20:04 -0700
      Re: creating a new local variable after a goto Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-10-13 12:23 +0100
    Re: creating a new local variable after a goto Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-13 21:56 -0500
      Re: creating a new local variable after a goto "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-10-13 20:11 -0700
        Re: creating a new local variable after a goto Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-13 22:45 -0500
          Re: creating a new local variable after a goto "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-10-13 20:54 -0700
            Re: creating a new local variable after a goto "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-10-13 20:55 -0700
            Re: creating a new local variable after a goto Gawr Gura <gawrgura@mail.hololive.com> - 2022-10-14 04:41 +0000
            Re: creating a new local variable after a goto Ralf Fassel <ralfixx@gmx.de> - 2022-10-14 11:53 +0200
            Re: creating a new local variable after a goto scott@slp53.sl.home (Scott Lurndal) - 2022-10-14 13:48 +0000
              Re: creating a new local variable after a goto Richard Damon <Richard@Damon-Family.org> - 2022-10-14 13:38 -0400
                Re: creating a new local variable after a goto scott@slp53.sl.home (Scott Lurndal) - 2022-10-14 17:53 +0000
                Re: creating a new local variable after a goto Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-11-15 16:26 -0800
                Re: creating a new local variable after a goto Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-11-15 17:05 -0800
          Re: creating a new local variable after a goto Andrey Tarasevich <andreytarasevich@hotmail.com> - 2022-10-14 01:07 -0700
            Re: creating a new local variable after a goto "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-10-14 14:32 -0700
          Re: creating a new local variable after a goto Manfred <noname@add.invalid> - 2022-10-15 01:56 +0200
  Re: creating a new local variable after a goto Andrey Tarasevich <andreytarasevich@hotmail.com> - 2022-10-12 19:59 -0700
    Re: creating a new local variable after a goto Lynn McGuire <lynnmcguire5@gmail.com> - 2022-10-13 21:55 -0500

csiph-web