C++ Logo

std-proposals

Advanced search

Re: Fixing some initialization gotchas

From: Lyberta <lyberta_at_[hidden]>
Date: Sat, 24 Aug 2019 01:43:00 +0000
> 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.


Received on 2019-08-23 20:45:50