Primzahlen
The magnanimous Eric Holbrook unwaveringly opined that it is possible to generate the prime numbers using g++ error messages.
template <int i> struct D { D(void*); operator int(); };
template <int p, int i> struct is_prime {
enum { prim = (p==2) || (p%i) && is_prime<(i>2?p:0), i-1> :: prim };
};
template <int i> struct Prime_print {
Prime_print<i-1> a;
enum { prim = is_prime<i, i-1>::prim };
void f() { D<i> d = prim ? 1 : 0; a.f();}
};
template<> struct is_prime<0,0> { enum {prim=1}; };
template<> struct is_prime<0,1> { enum {prim=1}; };
template<> struct Prime_print<1> {
enum {prim=0};
void f() { D<1> d = prim ? 1 : 0; };
};
#ifndef LAST
#define LAST 18
#endif
main() {
Prime_print<LAST> a;
a.f();
}
Save this off as dedekind.C and then abuse gcc with the nefarious recipe.
% g++ -DLAST=30 dedekind.C 2>&1 | grep "error: "
error: initializing argument 1 of `D<i>::D(void*) [with int i = 29]'
error: initializing argument 1 of `D<i>::D(void*) [with int i = 23]'
error: initializing argument 1 of `D<i>::D(void*) [with int i = 19]'
error: initializing argument 1 of `D<i>::D(void*) [with int i = 17]'
error: initializing argument 1 of `D<i>::D(void*) [with int i = 13]'
error: initializing argument 1 of `D<i>::D(void*) [with int i = 11]'
error: initializing argument 1 of `D<i>::D(void*) [with int i = 7]'
error: initializing argument 1 of `D<i>::D(void*) [with int i = 5]'
error: initializing argument 1 of `D<i>::D(void*) [with int i = 3]'
error: initializing argument 1 of `D<i>::D(void*) [with int i = 2]'
Bumper has proved this inadvertent programming paradigm to be Turing-complete. As a result, I’m diligently coding a new interpreted web frame work called “Gronky!”. The output is generated exclusively with gcc error messages which are then consumed by Zeus just as a munted man consumes libations. Expect a feature-complete alpha upon the return of Hale-Bopp.
Trackbacks
Use this link to trackback from your own site.





