Re:Having fun abusing the C language
by gefh on Tuesday October 25, 2016 @02:21PM
(#12790242)
Legit usage:
#define private public
#include "some old thing I need the internals of but can't change.h"
[ Parent
| on HN ]
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.)
Re:Having fun abusing the C language
by hairy_man674 on Tuesday October 25, 2016 @03:55PM
(#12791119)
> Seems like the kind of thing they'd do
Forced to do by Microsoft C and C++ that mangle names.
Re:Having fun abusing the C language
by hairy_man674 on Tuesday October 25, 2016 @03:29PM
(#12790921)
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...