Tuesday, November 28, 2006

HP-UX is annoying

Spent the day porting code to HP-UX 11 on Itanium. Discovered this little gem that was causing compilation failures all over our code:

The following code is not legal under the latest revision of the HP aCC compiler:

int main()
{
for (int i = 0; i < 5; i++) {
   // Do something
}
for (int i = 0; i < 5; i++) {
   // Do something else
}
return 0;
}

In their infinite wisdom, they decided to intentionally violate the ISO C++ standard on variable scoping, and to do it by default unless you explicitly tell them not to via a compiler switch:

http://docs.hp.com/en/6162/migrate.htm#forstatement

To add insult to injury, they added this functionality intentionally. Their old compiler operated in accordance with the standard:

http://docs.hp.com/en/6162/migrate.htm

VERY ANNOYING.