Hacker News new | ask | show | jobs
by gefh 3531 days ago
Legit usage: #define private public #include "some old thing I need the internals of but can't change.h"
2 comments

There's at least one compiler that adds visibility into the name mangling (is it gcc? Seems like the kind of thing they'd do), so if you unhide functions in this way you still won't necessarily be able to call them.

(The compiler is also free to change the object layout when you do this, too, though I've no idea whether any of them do.)

> Seems like the kind of thing they'd do

Forced to do by Microsoft C and C++ that mangle names.

C has no such keywords. Why the need for this hackery? Curious also if putting that in a header and including it in a C++ program even compiles without leading to undefined behaviour...