Quick, why does this give me a compiler error?

if      (dIntersectionZ <  box.GetChild(0,0,0).GetBox().Min.z) Assert(false);
else if (dIntersectionZ <  box.GetChild(0,0,1).GetBox().Min.z) z = 0;
else if (dIntersectionZ <  box.GetChild(0,0,2).GetBox().Min.z) z = 1;
else if (dIntersectionZ <= box.GetChild(0,0,2).GetBox().Max.z) z = 2;
else                                                           Assert(false);

The compiler complains that the else in the second line does not belong to any if.

Assert isn’t a function, duh!

From MyAssert.h, included in some completely inobvious place:

#define Assert(x)   if (!(x)) {printf("Error:\n  File %s\n  Function %s\n  →
    Line %i;,__FILE__,__FUNCTION__,__LINE__);{ static FILE *fOut; static char  →
    sName[100]; _snprintf_s(sName,99,"Error_%x.log",sName); fopen_s(&fOut,sNam →
    e,"wb"); if(fOut){fprintf(fOut,"Error:\n  File %s\n  Function %s\n  Line % →
    i",__FILE__,__FUNCTION__,__LINE__);fclose(fOut);}} assert(0); exit(999);}

Moral of the story:

Preprocessor macros make for some really entertaining afternoons.

Oh, and avoid C++ wherever possible.