cpp: number of hacks to get it to compile