Month: April 2008

Good News

Past Monday we got news about our children. Very good news indeed. First they are fine and healthy. Next they already know about us and “are waiting for us”. I think that these are the two most wonderful news an adopting parent would like to learn about.

Lost… Privacy

I am bit puzzled discovering that Italian Income Agency published on their website, freely available to everyone, income and birthday information for each Italian taxpayer. So, now, everybody could know the income (net or gross, you chose) about everybody else. Worse, data are filed by home town. So everybody can grab a lot of sensitive information in a semi-automated way from a public website.

20 dollars… Jamaican dollars

If you live in the eurozone beware of the coin changes. This morning I tried repeatedly to put a coin in the coffee machine without success, only to discover, to my surprise that the coin was not a 1€ coin, but a 20$ Jamaican.The coin has the very same size and thickness of a current 1€ coin, also the two parts (the external gold colored and the internal silver colored) have the same size and proportions. It is nearly impossible to distinguish the two coins without a close examination.
As of today exchange rate this funny thing is worth about 0.18€, so beware!

c++0x and auto

According to the acronym C++0x, we shouldn’t be waiting for the next language standard more than one year and half. According to the uneasiness I read in the messages from the committee board, maybe the waiting could last slightly more. Anyway the next C++ is about to debut. By reading what is going to pop up in the next standard, I got the strong impression that this is another step away from the original language. Let’s face it, C++ 98 (ISO/IEC 14882:1998) is a first step away from the original, non-standard language that included templates as an afterthought. It took years for compiler vendors to reach compliance, leaving the developer community in a dangerous interregnum, a nobody’s land where portability and maintainability concerns where stronger than writing proper code. Also the standardization process left a number of lame aspects in the language – the iostream library, inconsistencies in the string class and the other containers, a mind boggling i18n support, no complete replacement for C standard library, just to name the firsts that come to mind.
The next standard seems to take a number of actions to plug the holes left in the previous one and a number of actions to define a new and different language. For example there will be a new way to declare functions, that will make appear pale an unoffensive the transition from K&R style to ANSI C. What today is declared as:

int f( char* a, int b )

is going to be declared also as:

[] f( char* a, int b ) -> int

I understand there’s a reason for this, it’s not just out of madness, nonetheless, this is going to puzzle the Joe Average developer. Once the astonishment for the new notation is expired, how is he supposed to declare functions?
The impression I got about C++0x going to be a different language has also been reinforced by a sort of backpedaling on the “implicit” stuff.
C++ has a lot of stuff going on under the hood. Good or bad, you chose, nonetheless you get by default a number of implict stuff, e.g. a set of default methods (default constructor, destructor, copy constructor and assignment operator), and a number of implicit behaviour, such as using constructors with a single argument as conversion constructor.
Now this has been considered no longer apt for the Language, so modifiers to get rid of all this implicit-ness has been introduced. E.g. conversion operators may be declared “explicit” meaning that they will not be used implicitly when an object is evaluated in a suitable context. In a class each single default method can be either disabled:

class Foo
{
    public:
        Foo() = delete;
};

Or explicitly defined as the default behaviour:

class Foo
{
    public:
        Foo() = default;
};

 

 

Again I see the rationale behind this, but I find that changing the rules of the language after 30 years of its inception is going to surprise many a developer.
One of the most welcomed addition in the new standard, at least in my humble opinion, is the new semantic for the auto keyword. If you use the STL part of the standard on a daily base, I’m quite sure you are going to agree. Let’s take for example something like:

std::vector< std::pair<bool,std::string> > bar;

After some manipulation say you want to sweep through the vector with the iterator idiom. You can wear a bit your keyboard by writing the short poem:

for( std::vector< std::pair<bool,std::string>>::iterator i=bar.begin(); i != bar.end(); ++i ) ...

 

 

I usually go for a couple of typedef so that the iterator type can be written more succinctly. The new standard allows the programmer to take a shortcut. If the type of the iterator is defined by the return type of bar.begin() then it could be catch internally and used to declare i. That turns out as:

for( auto i=bar.begin(); i != bar.end(); ++i ) ...

As you see, this is extremely more readable (and writable altogether).
Well, well, well, too bad we have to wait at least one year for the standard and an uncountable number of years before vendors update their compilers. But, if you use GNU C++ then you may not be helpless.
GNU C++ implements the typeof extension. Just like sizeof evaluates to the size of the type resulting from the expression to which it is applied, typeof evaluates to the type resulting from the expression to which it is applied. E.g.:

int i;
typeof( &i ) // evaluates to int*.

(this works much like the decltype keywords of the next C++ standard). Given that the expression to which typeof is applied is not evaluated, then no side effects could happens. And this calls for the handy preprocessor:

#define AUTO(V__,E__) typeof(E__) V__ = (E__)

Now this macro does much the yet-to-come auto keyword does:

for( AUTO(i,bar.begin()); i != bar.end(); ++i ) ...

Note that typeof doesn’t do well with the references, so, in some cases (such as the example below) could behave unexpectedly:

#include
#include

std::string foo( "abc" );

std::string const& f()
{
    return foo;
}

int main()
{
    AUTO( a, f() );
    std::string const& b = foo();
    std::cout << "a=" << a << "n";
    std::cout << "b=" << b << "n";
    foo = "cde";
    std::cout << "a=" << a << "n";
    std::cout << "b=" << b << "n";

    return 0;
}

If your compiler of choice doesn’t support typeof (or decltype), then you have to wait for it to become C++0x compliant.

Bah

From The Guardian:”[…] Berlusconi’s triumph will send a shiver of apprehension through Brussels, where memories are still fresh of the way his government let Italy’s public finances run out of control, threatening the stability of the euro. Romano Prodi, the former European commission president and Italy’s ex-prime minister who narrowly defeated Berlusconi two years ago, reversed the trend. But to cut the budget deficit, he made the centre-left deeply unpopular by raising taxes and clamping down on evasion.
[[…]
The country looks set for five years of government headed by a 71-year-old man who has a string of trials behind him for alleged financial wrongdoing. All his convictions have been overturned on appeal and other charges against him expired under statutes of limitations.”

From The Times:
“Above all Mr Bossi will expect high office, even though he had a severe stroke four years ago and can still barely speak.
Mr Bossi has, however, described African immigrants as “Bingo Bongos” and said illegal immigrants arriving by boat should be “blown out of the water”. During the election campaign he called on his supporters to “take up arms” against “that rabble in Rome” over allegedly confusing ballot papers.
[…]
Some local League leaders have called for separate train carriages for immigrants, and the former mayor of Treviso, Giancarlo Gentilini, removed park benches in the town on the grounds that immigrants slept on them, remarking “We should dress them up like hares – and then, bang bang bang”.

Madness concept considered harmful

I read too much sci-fi to not be concerned about the recent claims I read about in the press. I found that “madness” boundaries are quite fuzzy, just have a look at the definition of Insanity on Wikipedia. Being a danger for himself and the people in general by flouting societal norms is quite vague, and you can stretch it to fit a number of behaviors that ranges from criminal to acceptable though odd or unusual.On the thin ice of the latter side, the “mental insane” label could be applied on who is just different from you, who do not fully conforms to the canon. And here we go on the even thinner ice of who decides which the canon is.
That why a political agenda that contains the “more mental sanity checks for these people or those” sounds creepy to me.
Given the backlog of the politician shouting these claims, who this man would consider mental among judges and magistrates? Those investigating on his business?
You may well consider both refusing being corrupted and investigating on one of the most powerful men (if not the most powerful) in Italy something that flouts our pitiful societal canons.

Good Intentions

The road to hell is paved with good intentions, or something like that. Well I have the best intentions to keep my blog active and I have plenty of stuff to write, I am just lacking time. Anyway I have completed my reading of Death March, great book, I’d like to write my summary/review, but I noticed that I failed to write about nearly all books I liked most – Facts and Fallacies of Software Engineering, Joel Spolsky on …, Design and Evolution of C++ and likely others that don’t come to mind right now. While I write more or less regularly (regularly irregular, yeah!) about all the rest. The reason is quite simple, since I like these books so much I’d like to write thorough reviews, with deep insight of why I liked or why these readings have been so much mind changing. Unfortunately I have simply not such amount of uninterrupted free time to do so.
Another theme I would have liked to write something about is racism. I am going to have two non-EC children. Well they’ll be Italians, but they look wonderfully South American. My wife and I like them a lot as they are, but we’re getting (more and more) sensitive about the racism issue. For example I was struck by the comparison among the Italian and US law about police to pull car drivers up. In Italy police forces (and we have plenty of them – police, carabinieri, local police) may halt anyone for inspection without any required justification, while US highway patrols can halt people only when they detect an infringement.
To an Italian this may look ineffective, but that makes a lot of sense when you connect it with the fundamental right to be all equal in front of the law. What prevents an Italian policeman to routinely halt cars driven by non-EC people just “because, you know how they are…”? Wouldn’t be this racism? And the same goes for ticket inspectors on buses and trains.
The other point about racism is that if the word “race” makes sense for human kind. After all words are not just handles to concepts, they bring a flavor with them, they trigger connections… well, with good approximation, we can say that according to modern science there are no such a things as different human races. Every difference we can spot beyond the skin color between, say, a black and a white are only social and cultural. Glad to see that science supports what is just good sense – “something in the blood” or “that thing in the DNA” is just bullshit when talking about behaviors.
On a lighter topic, I completed Mass Effect on X360. That’s definitively a good game. I liked it much. The story is pretty solid, the talks and pick-your-answer choices are the friendliest in the RPG panorama. I am a bit puzzled about the rating – 18 years, in the same class Bioshock is. While I fully agree about Bioshock being rather disturbing and surely non apt for underage boys, I didn’t find anything like that for Mass Effect. The violence level is quite soft, we’re about at the same level of the A-Team series. The story either is not so shocking to justify the age restriction. I would be much concerned for my children to watch the last episode of the Pirates of the Caribbean than to let them playing Mass Effect. Maybe the reason is the would-be-sex scene of the romantic subplot. I know that videogames are under a magnifying glasses so the rating agency prefers to err on the conservative side, but come on, we are in the 2008, there’s nothing in this game that, even far, approaches what every children can watch in TV prime time.
Another topic I’d like to deal on these pages is the UbiSoft Milan studio history. I have been so lucky to be there nearly from the very beginning of the long and, under many aspects, successful adventure, that I like to tell the whole tale from inside. I have an “history” document that I wrote a long ago, that needs a good rewrite.
Eventually I’d like to mention the last initiative by Beppe Grillo, the V2-day for a better news-industry in Italy.
Well this is, more or less, everything I have on my (virtual) desk, as you can see I have no blank-page-syndrome, I have just no time and this magnificently paved road ahead.