Jul 15, 2008

Another one in the obscure codding practices ...

As I said in this post, today I've found an interesting site about C++ programing practices. While reading this pages I learned another way to write a fragile application (as always, writing bad code is enough :) So, let's go for it! What will be the output of the following program?
void main(int argc, char* argv[])
{
  int n = 255;
  size_t size = sizeof(++n);
  printf("%d", n);
}
Maybe this be can pretty obvious to you, but it was not to me (maybe because I avoid to write obscure code as much as I can :) Adriano

No comments: