I Have No Constructor, and I Must Initialize

https://sh.itjust.works/post/21826695

I Have No Constructor, and I Must Initialize - sh.itjust.works

(the joke is C++)

Did you read all the way to the end of the article? I did. I took your “The joke is C++” comment on board, and as I read more and more of the article I became more and more annoyed, thinking about the comment that I’d write here.

Then I got to the very bottom of the piece and found that the author had already expressed what I wanted to say quite well:

In my humble opinion, here’s the key takeaway: just write your own fucking constructors! You see all that nonsense? Almost completely avoidable if you had just written your own fucking constructors. Don’t let the compiler figure it out for you. You’re the one in control here.

You’re not supposed to rely on default constructors. They’re a stop-gap provided out of the goodness of compiler writers’ hearts.

If you want your compiler to do more of the work for you, you’re welcome to pick another language. Probably one with indecisive garbage collection and a single “number” type.

Can’t it be both? :)