Abusing C macros to render the Mandelbrot Set at compile-time

  • This is really neat. I changed the quality value to 6: clang took ~20 minutes to compile and it used around 32GB of RAM. The resulting executable is 13KB, and it generates a 4KB image as output.

    Here's a link of the output image: https://imgur.com/cUdForu

  • Just as a FYI, this takes a while to compile:

      $ pbpaste | time clang -x c -
             99.35 real        82.72 user         9.94 sys
    
    If you're using iTerm, you can pipe the output of the program to imgcat to see the result without leaving your terminal.

  • Can we please have constexpr in C 2x to put an end to this madness?

  • $ cc -E cursed_mandelbrot.c | wc 546 8804289 76385728

    The pre-processor outputs 76,385,728 chars on 546 lines

  • Off topic but I think some of you fellow math geeks will get a kick out of the Mandelbrot Set song by Jonathan Coulton.

    https://youtu.be/ZDU40eUcTj0

  • I clicked on it and expected an IOCCC contest entry or something...

  • Getting

    "virtual memory exhausted: Cannot allocate memory"

    when trying to compile :/

  • MSVC 2017 x64 (v19.15.26730) fails with Error C1060: compiler is out of heap space.