+ 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++?
3 Respostas
+ 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
+ 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
+ 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.