Funny programming pictures, jokes & quotes

Discussion about everything. New games, 3d math, development tips...
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Post by Mel »

Great that i <3 u...
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Post by ent1ty »

The funny part was supposed to be the mushrooms.... nevermind.
I guess i should have said that he is 14.
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
kazymjir
Posts: 727
Joined: Sat Feb 20, 2010 4:05 pm
Location: Munich, Bayern

Post by kazymjir »

Mushrooms are very good :D
Unfortunately, it's not season for shrooms.


Image

This one is good :D
Brainsaw
Posts: 1183
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

Hello World? Need vacation ;)
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
kazymjir
Posts: 727
Joined: Sat Feb 20, 2010 4:05 pm
Location: Munich, Bayern

Post by kazymjir »

Brainsaw, are you sure? :D
pippy3
Posts: 155
Joined: Tue Dec 15, 2009 7:32 am

Post by pippy3 »

Code: Select all

a: 
   goto a


I think it will get into an infinite loop.
Brainsaw
Posts: 1183
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

kazymjir wrote:Brainsaw, are you sure? :D
Just a wild guess ;). It does, however, almost look as good as the "hello world" of Brainfuck ;)
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
kazymjir
Posts: 727
Joined: Sat Feb 20, 2010 4:05 pm
Location: Munich, Bayern

Post by kazymjir »

This picture is very trickery.
All people is starting to analysis those hexadecimal ascii values, but...
look at printf function.
Is there something missing? :)
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

why would you need a separate format string when you already built one? Should work without any problems.
kazymjir
Posts: 727
Joined: Sat Feb 20, 2010 4:05 pm
Location: Munich, Bayern

Post by kazymjir »

Ok, I will give you solution.
This code will output... an error.
Why? Because printf() is in stdio.h, which is not included in this code :)

Solutions of most problems are very easy, but human perception always looking for complex solutions, not seeing simple patterns.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

No, that's an incomplete answer. The thing is that the output of this function was searched. It's also called _tmain, which will probably also not link without a proper main(). But you could still define the output of this function in case it's called (which would also require that it's properly linked before).
Bate
Posts: 364
Joined: Sun Nov 01, 2009 11:39 pm
Location: Germany

Post by Bate »

Put aside all the sophistry and it actually says "Hello World" ;)

Code: Select all

#include <stdio.h>

int main()
{
  char* p=new char[12];*p=0x48;++p;*p=0x65;++p;*p=0x6c;
  ++p;*p=0x6c;++p;*p=0x6f;++p;*p=0x20;++p;*p=0x57;++p;
  *p=0x6f;++p;*p=0x72;++p;*p=0x6c;++p;*p=0x64;++p;
  *p=0x0;--p;--p;--p;--p;--p;--p;--p;--p;--p;--p;--p;

  printf(p);
  delete p;

  return 0;
}
Never take advice from someone who likes to give advice, so take my advice and don't take it.
kazymjir
Posts: 727
Joined: Sat Feb 20, 2010 4:05 pm
Location: Munich, Bayern

Post by kazymjir »

hybrid wrote:It's also called _tmain, which will probably also not link without a proper main().
_tmain is used in VC++. _t* functions is calling ANSI functions if _UNICODE isn't defined. If _UNICODE is defined, it's calling UNICODE version of that function.
So everything is ok, proper main will be called (main if ANSI, wmain if UNICODE).
But, there don't even must be main() function. Why?
Because, compiler is working always first. If compiler found error in code, it will not run linker.

So, output will be an error that printf() function is not found.
Linker will be not called, because of error found by compiler in code :)
Last edited by kazymjir on Wed Feb 09, 2011 9:31 am, edited 1 time in total.
Brainsaw
Posts: 1183
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

Here is my optimized version:

Code: Select all

  #include <stdio.h>

int main() {
  char *p=new char[13];
  *p++=0x48;*p++=0x65;*p++=0x6c;*p++=0x6c;*p++=0x6f;
	*p++=0x20;*p++=0x57;*p++=0x6f;*p++=0x72;*p++=0x6c;*p++=0x64;*p++=0x0A;*p=0;
  --p;--p;--p;--p;--p;--p;--p;--p;--p;--p;--p;--p;printf(p);return 0;
}
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
kazymjir
Posts: 727
Joined: Sat Feb 20, 2010 4:05 pm
Location: Munich, Bayern

Post by kazymjir »

Let's do more optimization!

Code: Select all

int main() {
	char *p=new char[13];
	*p++=0x48;*p++=0x65;*p++=0x6c;*p++=0x6c;*p++=0x6f;
	*p++=0x20;*p++=0x57;*p++=0x6f;*p++=0x72;*p++=0x6c;*p++=0x64;*p++=0x0A;*p=0;
	--p;--p;--p;--p;--p;--p;--p;--p;--p;--p;--p;--p;
	__asm__("\
		movl $4, %%eax\n\
		movl $0, %%ebx\n\
		push %0\n\
		pop %%ecx\n\
		movl $13,%%edx\n\
		int $0x80" : :"g"(p)); return 0;
}

Post Reply