Learning C++ – The Bullshit (part 2)
Let me list some more bullshit I just learned.
struct++
A struct can have a function as member? So this is valid C++ code:
struct foo { void * initthiscrap(); }
What the hell? Even worse: You can inherit from a structure! Seriousely? You can inherit from a fucking structure? No shit, Sherlok!
Implicit type conversion
This one is even worse. Lets have a look at the following code:
Dot give_dot(void) { return 5; }
Dot is a class. This code is valid. What the fucking hell? In C++ it is legal
to convert without any sematic for it. That sucks. Period.
Dot a = 5;
Automatic constructor calling
I already used the folling syntax:
Dot a(); Dot b(4);
But did you know that
Dot c;
Does also call the constructor for c ? What the fucking hell is this? I
declare the variable c, but no... C++ won't let you do that! It calls the
constructor for Dot. Why? Because it is bullshit!
Sidenote: I would expect this
Dot c();
to include the constructur-call. But not without the parentheses!
tags: #programming #c++