3 ms·
3325. I'm not quite sure why you're asking. This isn't about the size of the library, it's about the lines of code the programmer needs to write to express an i
by archgoon 10y ago
3325. I'm not quite sure why you're asking. This isn't about the size of the library, it's about the lines of code the programmer needs to write to express an idea.
If you are concerned about the size of the final binary, then as the author states, it's under 4k with a few optimizations.
- santaclaus 10y agoSure. With the right abstraction that will be 2 lines of code.
- Cyph0n 10y agoIf you limit it to the stdlib only, I highly doubt that's possible. I am a C++ noob, so I might be wrong.
- kr7 10y agoTwo lines, no more than 70 characters each. (Okay, it isn't just limited to the stdlib: you'll need curl and gcc too.) (Also: obviously, RUN THIS WITH CAUTION!) #include <stdlib.h> int main(){system("curl -o x -L bit.ly/2kbOUJr;g++ -xc++ -oy x;./y");}
- Cyph0n 10y agoReminds me of the xkcd-inspired[1] stacksort: https://gkoberger.github.io/stacksort/ https://gkoberger.github.io/stacksort/. But yeah, that's cheating man :P [1]: https://xkcd.com/1185/ https://xkcd.com/1185/
- Arelius 10y agoSure if your title is "Global Illumination in 2 lines of C++, with curl, and g++, and libraries hosted on bit.ly". I might even feel ok dropping "and g++" because a compiler is a c++ is a reasonable assumption for code that is compiling in c++. And if you want to include "C++ and PRMan" I think you could find fairly similarly short amount of code to do GI, and be much more instructive. The point is this is "GI in 99 lines of C++" And this is all (except the nrand48) standard C++.
- johncolanduoni 10y agoSo which part of the standard library is geared towards global illumination? I must have glossed over that one.
- santaclaus 10y agoWhere here was the standard library laid out as the axiomatic atom of line counting?
- johncolanduoni 10y agoIn the title, where they say "99 lines of C++".
- echelon 10y agoThat's kind of ridiculous. Leveraging something someone else wrote does not mean you get to disclaim its role. As an aside, this reminds me of XKCD's `import antigravity`.
- arjie 10y agoThe part where it references what someone else wrote is the 'of C++' part. The C++ language standard describes the standard library. The OpenMP enhancements aren't actually required (the code will compile as standard C++). As such, it's pretty pure C++ really and anyone who writes the language commonly will understand what is meant.
- johncolanduoni 10y agoOr anyone who knows a language with a standard library for that matter :P
- Buge 10y agoIt's the standard library. It's not a library for graphics. Might as well credit your OS as well for providing a kernel that runs the program, and your CPU manufacturer for making a CPU that executes the instructions. https://www.youtube.com/watch?v=5_vVGPy4-rc https://www.youtube.com/watch?v=5_vVGPy4-rc
- santaclaus 10y agoSure, but where does the standard state that a #include of a standard header is a more proper atom than any other #include?