Readit News logoReadit News
ndanilov commented on C++: Zero-cost static initialization   cofault.com/zero-cost-sta... · Posted by u/oecumena
forrestthewoods · 2 months ago
> For this we need a certain old, but little-known feature of UNIX linkers

STOP WRITING NON-PORTABLE CODE YOU BASTARDS.

The correct answer is, as always, “stop using mutable global variables you bastard”.

Signed: someone who is endlessly annoyed with people who incorrectly think Unix is the only platform their code will run on. Write standard C/C++ that doesn’t rely on obscure tricks. Your co-workers will hate you less.

ndanilov · 2 months ago
Author here. This is part of SPDK-based server code. Transportability outside of UNIX (mostly Linux) is entirely irrelevant. By the way, the global variables here are immutable after the initialisation, that's the point.
ndanilov commented on     · Posted by u/ndanilov
ndanilov · 2 months ago
How to avoid memory barrier and synchronisation for dynamic initialisation of block-level static objects in C++.

Dead Comment

Deleted Comment

u/ndanilov

KarmaCake day59October 25, 2015View Original