+ 4

Unknown stuff in c++

There are lots of things in c++ that are not commonly known among its users like virtual inheritance, final virtual functions and final classes, usage of the ternary operator as a lvalue, that Array[index] is the same as index[Array] or placement new. Do you know any other obscure or weird features of c++?

29th May 2018, 11:05 PM
Max
Max - avatar
3 ответов
+ 6
- function try/catch blocks made me scratch my head pretty hard when I first heard about them. I understand the usecase but it feels badly designed and forced, and it looks super ugly. And it's not like I've ever seen it being used anyway. - Also look up the "most vexing parse" - it's not a feature, but very C++. - Trigraphs! For keyboards that don't have certain letters on them (C/C++ are *that* old). I think they removed them in new versions of C++ though. - Duff's Device deserves a mention, abusing syntax like you couldn't in any other language! - const rvalue references. uhm.. - C++ templates are turing complete, so they are like a programming language within a programming language and I guess that makes gcc an interpreter in some sense? :D
29th May 2018, 11:20 PM
Schindlabua
Schindlabua - avatar
+ 4
-i don‘t see namespace aliasing used often -ref qualifiers and overloading using ref qualifiers -using mutable to differentiate between bitwise and logical const -explicit constructors -conversion functions -function objects
29th May 2018, 11:48 PM
Max
Max - avatar
+ 4
Metaprogramming in C++ is one big black hole for me. I kinda understand the basics, but when I first read about SFINAE I was ready to jump out of the window, because of head ache.
29th May 2018, 11:57 PM
Jakub Stasiak
Jakub Stasiak - avatar