Remix.run Logo
lovich 5 hours ago

I can read C/C++ code about as well as I can read German. Bits and pieces make sense but I definitely don’t get the subtleties.

What’s eye bleachy about this beyond regular C/C++?

For context I’m fluent in C#/javascript/ruby and generally understand structs and pointers although not confident in writing performant code with them.

jeffbee 5 hours ago | parent [-]

For one thing, "C/C++" is not a thing. If you see C-like C++, that is C.

Part of OpenSSL's incomprehensibility is that it is not C++ and therefore lacks automatic memory management. Because it doesn't have built-in allocation and initialization, it is filled with BLAH_grunk_new and QVQ_hurrr_init. "new" and "init" semantics vary between modules because it's all ad hoc. Sometimes callees deallocate their arguments.

The only reason it needs module prefixes like BLAH and QVQ and DERP is that again it is not C++ and lacks namespaces. To readers, this is just visual noise. Sometimes a function has the same name with a different module, and compatible function signature, so it's possible to accidentally call the wrong one.