Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The C++ versions were compiled using gcc version 4.4.5 using the compiler flags “-O6 – lpthread”.

Isn't -O6 the same as -O3 ?



Fortran compilers (gcc has a Fortran 95 frontend) have long offered optimization levels beyond -O3; i.e., -O6 is a decent upper bound among popular free and commercial compilers, not just gcc/gfortran. The author probably came from a HPC background where -O6 is commonly used for compatibility among such a variety of compilers, even when writing C and C++ programs. Technically not the most portable way to build, but it works.


I asked the engineer for a response: "For reference, I used -O6 because it's a historical convention (more of a joke, really) for "optimize the crap out of it". UNIX geeks have been using -O6 in this way for about 30 years."


Yes it was a very WTF moment for me as well. The "C++" code is pretty much straight C, with references being the only C++ feature being used.


It might look like C, but the last time I looked to the C++ standard that is also valid C++ code.


Yes -O3 is the maximum. Anything higher than (-O1000) just runs -O3.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: