C++ Logo


Advanced search

Subject: Re: [std-proposals] Fixing some initialization gotchas
From: Lyberta (lyberta_at_[hidden])
Date: 2019-08-23 20:43:00

> You say when you look at `auto x = {1}`, the only logical explanation in
> your mind is that the RHS is an initializer list but you have no intuition
> for `auto x{1}`. But in the context of teaching C++, why would that be?

I think using `=` for initialization is a bad idea because now `=` has 2
different meanings: initialization and assignment. If we focus on making
initialization via `=` forbidden, we can have a better syntax.

I think std::initializer_list (or a saner version of it) should get a
completely new syntax that is unambiguous.

STD-PROPOSALS list run by herb.sutter at gmail.com

Standard Proposals Archives on Google Groups