4 ms·
I'm confused why are they trying to implement name mangling in C? Are they trying to use the C++ compiler to implement the RAII assembly code and then link that
by potbelly83 2y ago
I'm confused why are they trying to implement name mangling in C? Are they trying to use the C++ compiler to implement the RAII assembly code and then link that back into C? Wouldn't a smarter approach be to do a C version of what C++ does?
- jay-barronville 2y agoI thought the author covered that pretty well. How would you make sure that function calls and object lifetimes are managed correctly/deterministically while also remaining compatible with existing C++ code and compilers without having to have `extern "C"` everywhere? Edit: I just reread this comment and realized the beginning of it could come across as a bit condescending even though that wasn’t at all my intention. I’d edit it out, but I don’t like doing that, so my apologies if it did come across that way!
- nicebyte 2y agothey're not. they're saying "if we had constructors in c, we'd need a mechanism to allow multiple constructors for the same type". in c++ function overloading and mangling are used to get that, but it's far from the only way something like that could be achieved. imo that whole part could be removed, it's like a little distraction and doesn't really have anything to do with the core of their argument.
- potbelly83 2y agothanks! appreciate the reply