Jul 23, 2008

My mind is about to blow

Hi. That computer technology evolves day by day and the amount of information in this area is gigantic many of you already know (so do I), but today I was talking to a friend of mine and I realized how many books I want to ready (only in the subject Windows + .Net). If you are curious you can see the list here but most of them were not published yet (and here you can find a list of some books I've already read / I'm reading). What do you think about them? Is there any other book related to .Net / Windows development you consider a must? PS: Feel free to give some of them as a gift when they get published :) Adriano

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

CERT C++ Secure Coding Standard

Hi. Today I reached this page (on cert.org) site talking about C++ secure standard practices. I haven't read it to the end yet but at a first glance it looks pretty interesting (and useful) to me. Wait, don't call yet!! There's a page regarding safe practices for C also! I'll be reading this as soon as I get some time to ;) Adriano

Jul 2, 2008

What is wrong with this code?

I was reading some blogs this week and find an interesting story related to references in C++ (and as it has some time that I don't work/post about C++) so I decided to post about it. Take a look in the code and try to answer the following questions below:
#include "stdafx.h"
#include "stdio.h"

class SimpleClass
SimpleClass(int n)
   value = n;

void FirstMethod(TCHAR* str)

void SecondMethod()
  wprintf(L"Value: %d", value);

int value;

void Test(SimpleClass &ref, int i)
  case 1:
     ref.FirstMethod(L"Hello world\r\n");

  case 2:

int _tmain(int argc, _TCHAR* argv[])
SimpleClass *p = 0;

Test(*p, 1);
Test(*p, 2);

return 0;
  • Will it compile? run?
  • What would be the outcome from Test being called in line 39?
  • What about line 40?
  • Is there any other issues?
(PS: VS 2008 compiled it with no warnings....) Adriano