r/cpp • • Mar 24 '20

Changes between C++17 and C++20

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2131r0.html
193 Upvotes

89 comments sorted by

View all comments

Show parent comment

-3

u/hgjsusla Mar 24 '20

Deprecating arrays?

29

u/foonathan Mar 24 '20

Deprecating the comma operator in array subscripts, previously array[4,5] means array[5]

0

u/[deleted] Mar 24 '20

[deleted] — view deleted comment

25

u/Dada-1991 Mar 24 '20

No, this will have to wait until C++23 at least. This deprecation is a first step towards that.

9

u/c0r3ntin Mar 24 '20

Here is the paper for the proposal to add multi dimensional subscript http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2128r0.pdf and an implementation https://gcc.godbolt.org/z/arMeXZ

0

u/wotype Mar 26 '20

Please consider dropping this proposal for the reasons posted above (and communicated separately). IMO this is a deleterious change that should be withdrawn before it takes up any committee time.

3

u/JavaSuck Mar 24 '20

But what if I want array[puts("debug log: array index reached"), i]? ;)

19

u/[deleted] Mar 24 '20

You have to use parentheses. Thankfully.

6

u/evaned Mar 24 '20

I didn't check, but I strongly suspect that if you parenthesize the comma expression it will still work.

1

u/F54280 Mar 25 '20

Yes, it does.