Funky cpp trick

Some people. :LOL:
I think that code demonstrates the nasty side of C++ as well as the good side.

My take on that problem would be to use 4 vertices and use Bresenham's line algorithm to rasterise the stupid diamond.
 
Some people. :LOL:
I think that code demonstrates the nasty side of C++ as well as the good side.
CPP is referring to the C Pre-Processor., not C++ per se.

I saw one obfuscated C program that did (IIRC) a sieve of Eratosthenes almost entirely in the pre-processor. :oops:
 
I see the w which the preprocessor replaces with '*' referenced once in the code so there's probably some loop in there and 'h' assigned 011 is newline I think... the program structure seems pretty straight forward (unless I'm horribly wrong) but all this must have taken some time and effort! It's a really funny response since there's no way the guy asking the question will be able to use it for his actual homework! Imagine what an intro to programming teacher would say if he sees this as someone's submission... ;)
 
Last edited by a moderator:
I see the w which the preprocessor replaces with '*' referenced once in the code so there's probably some loop in there and 'h' assigned 011 is newline I think... the program structure seems pretty straight forward (unless I'm horribly wrong) but all this must have taken some time and effort! It's a really funny response since there's no way the guy asking the question will be able to use it for his actual homework! Imagine what an intro to programming teacher would say if he sees this as someone's submission... ;)
You can always have the CPP spit out the preprocessed version so you can see the code generated ;)
 
Back
Top