Live data from Hacker News

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

gist.github.com

21–23 of 23 posts

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

#21

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

As someone who doesn't do much C++, could `constexpr` actually do this all on its own? My (limited) understanding of `constexpr` would lead me to think that using it alone you couldn't generate the contents of the array like this. IE. You could define a `constexpr` function to calculate a single entry in the array, but you'd still need to call that function for every entry. In this case, it looks to me like the bulk…

> As someone who doesn't do much C++, could `constexpr` actually do this all on its own?

yes, some people have written entire constexpr raytracers for instance : https://github.com/tcbrindle/raytracer.hpp

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

#22
post #16

Getting "virtual memory exhausted: Cannot allocate memory" when trying to compile :/

Change the code from M4 to M3:- >#define C1(x,y) M3(XF(x), YF(y), XF(x), YF(y)), >// ^- change this to 5 or 6 to increase detail

  // ^- change this to 5 or 6 to increase detail or to 7 or 8 to melt your computer

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

#23

Earlier quoted context omitted.

It's virtual, so obviously you can just download more.

Makes me want to start a RAM-as-a-service company.

If you somehow manage to include bitcoins, industry 4.0 and machine learning into that then you'd also get a heap of VC money for the start!
Post reply on HN