https://h4x0r.org/big-mac-ro-attack/ #CPreprocessor #RecursiveMacros #LifeChoices #Kafkaesque #HackerNews #ngated
#define LM_IS_EMPTY_TUPLE(x) LM_SECOND_(_LM_IS_EMPTY_TUPLE x, LM_F)
#define _LM_IS_EMPTY_TUPLE(...) bogus, __VA_OPT__(LM_F,) LM_T
Yes, this is a good way to write code. There is nothing wrong with the language forcing you to do things like this. #CPreProcessor
Optimizing Brainfuck interpreter in the C preprocessor
https://github.com/camel-cdr/bfcpp
#HackerNews #Optimizing #Brainfuck #interpreter #in #the #C #preprocessor #HackerNews #Brainfuck #Cpreprocessor #Optimization #Programming
C++ isn't a serious language.
today's bullshit:
template<typename T, typename U, U T::* Member>
struct get_offset {
static constexpr size_t offset = offsetof(T, Member);
};
struct Example {
int x;
};
const size_t N = get_offset<Example, int, &Example::x>::offset;
This doesn't compile with clang. because...
1/2
I wonder if anyone has seriously thought about adding some kind of namespacing to the C preprocessor.
for example, it would be nice if you could say
#namespace FOO
#include "foo.h"
#endnamespace
and then all the preprocessor defines from foo.h are brought into your file with names like FOO###BOOL
my #DecemberAdventure has mostly been implementing in #Lua a #compiler from a subset of Lua to #C99, eventually aiming to target #OpenCL #C, with the end goal of number-type-generic #GPU -accelerated #fractal #graphics stuff.
Previously I was doing it with #CPreProcessor macro hell, compare this #MandelbrotSet inner loop:
before, lines 44 to 65 https://code.mathr.co.uk/carrottuba/blob/9784fdd2a4aac8390d22d5dca252b9ba5ea963ea:/c/bin/mandelbrot.h#l44
after, lines 22 to 38 https://code.mathr.co.uk/carrottuba/blob/9784fdd2a4aac8390d22d5dca252b9ba5ea963ea:/lua/fractals.lua#l22
Found a bug in #zoomasm's 360 projection (the distance estimate scaling was wrong).
Trying to do the maths by hand is too hard, so I copied my #GLSL #DualNumber implementation (for #AutomaticDifferentiation) from my fragm-examples repository, minus the #CPreProcessor macro hell, plus some quaternion-to-rotation-matrix code ported from Python that I found online.
Now it looks okish in the #equirectangular view, need to render some tests at various orientations and inject spatial metadata for viewing in VLC to be more sure I got it right...