C++ Logo


Advanced search

Re: Local variables

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Thu, 17 Feb 2022 17:27:18 -0500
On Thu, Feb 17, 2022 at 3:03 PM language.lawyer--- via Std-Discussion
<std-discussion_at_[hidden]> wrote:
> On 17/02/2022 22:48, Vladimir Grigoriev via Std-Discussion wrote:
> > Why are not block scope variables declared with the specifier static considered as local variables in the C++ Standard?

They are. See below.

> AFAIK currently there is no definition of such thing as local variable.

There is no such definition in post-C++20. But in C++20 and before,
there has been. From [basic.scope.block]/1:

> A variable declared at block scope is a local variable.

The current working draft in the same section calls them "block variables".

Received on 2022-02-17 22:27:29