5 ms·
Most beautiful cpp code I have seen in many years
by danielovichdk 4y ago
Most beautiful cpp code I have seen in many years
- russellbeattie 4y agoI was just about to make this same exact comment! I was half way down the page and thought, "Wait... What language is this again?" I had to scroll back up to confirm.
- JeffRats 4y agoClean and readable, more like C than meta filled C++ with templates.
- olliej 4y agoNah, it’s just having professional coding and review standards that are very heavily enforced. This particular code is also aided by being fairly simple in function of course. In my experience C code is generally worse than C++, as a lot of what large C projects do is stuff that C++ does automatically, and with more safety. That said for the most squirrely code in webkit you need to look to JSC where the perf critical and machine abusing code is stuck (though obviously minimized as much as possible). My most terrible contribution there is the parser which uses macros and templates together (parsing JS is extremely perf critical in real world page loading because the parser often has to deal with megs of code, all of which has to be parsed before you can consider executing it and in many places page loading is blocked on said execution)
- jyap 4y agoProbably because it’s mostly if statements, neat functions and string translation.
- ravenstine 4y agoIt's almost as if the reason C++ can suck is actually because most developers write code that's incomprehensible.