Get the latest tech news

Initialization in C++ is bonkers (2017)


Personal blog and CV for Sy Brand

Since the constructor for foo is defaulted on its first declaration, it is not technically user-provided – I’ll explain what this term means shortly, just accept this standardese for now. This rule makes sense when you think about it: without having access to the definition of a constructor, a translation unit can’t know if it is going to be a simple compiler-generated one, or if it’s going to send a telegram to the Moon to retrieve some data and block until it gets a response. This is a very subtle distinction which has inadvertently changed our program from executing safely to summoning nasal demons/eating your cat/ordering pizza/your favourite undefined behaviour metaphor.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of C++

C++

Photo of bonkers

bonkers

Photo of initialization

initialization

Related news:

News photo

Xenon is an open source universal game cheating framework C++

News photo

Matt Godbolt sold me on Rust by showing me C++

News photo

I started a devblog about mixing SwiftUI and C++ to make a Twitch app