If you are concerned about the size of the final binary, then as the author states, it's under 4k with a few optimizations.
If you are concerned about the size of the final binary, then as the author states, it's under 4k with a few optimizations.
As an aside, this reminds me of XKCD's `import antigravity`.
As such, it's pretty pure C++ really and anyone who writes the language commonly will understand what is meant.
If someone claimed "a string formatting tool in 2 lines of C++" and it was just fprintf, that's clearly the standard library doing the work, not the promoted file. In this case the standard library is not doing any global illumination or anything related. It's just doing IO.
'The facilities of the C standard Library are provided in 26 additional headers, as shown in Table 15.'
'<cassert> <cinttypes> <csignal> <cstdio> <cwchar> <ccomplex> <ciso646> <cstdalign> <cstdlib> <cwctype> <cctype> <climits> <cstdarg> <cstring> <cerrno> <clocale> <cstdbool> <ctgmath> <cfenv> <cmath> <cstddef> <ctime> <cfloat> <csetjmp> <cstdint> <cuchar>'
and
'Except as noted in Clauses 18 through 30 and Annex D, the contents of each header c name shall be the same as that of the corresponding header name .h, as specified in the C standard library (1.2) or the C Unicode TR, as appropriate, as if by inclusion'
Among other bits. It's made very clear that the standard libraries are valid 'C++'.
Even that aside, here are the used symbols from those libs:
atoi fopen FILE fprintf M_PI fabs sqrt cos sin erand48
Which are all resonable functionality to expect in any programming environment. The first 4 are only used for I/O which are not exposed in the language otherwise. And can also be safely removed and "GI" still functions. It's just nice to be able to see the result.
The rest of the math functions are generally replaceable with varying amounts of code or by calling platform native instructions.
The only real stand out is erand48 which isn't actually part of the standard, but is easily replaceable by many other standard pseudo random implementations something like 'double erand48(){return (double)rand()/(double)MAX_RAND;}' or some such, or by implementing one of many pseudo random number generators.
In all, it's very fair to consider this 99 lines of C++ all the algorithmic components of a path tracer are shown in the code. External code is well within expectations. And there is no reason to consider the usage of stdio.h as something to be counted, while discounting all the code that goes into actually compiling and executing the code. Where the line is now is the most obvious place to draw it and where all sane C++ programmers would.
They finally standardized M_PI? Sweet, that was always awkward.
By that logic: "If you wish to make an apple pie from scratch, you must first invent the universe" (quote by Carl Sagan).
(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");}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++.