What determines if program64.exe gets generated as against program.exe?

I thought I understood the pattern but I've a couple of sources that don't seem to follow my expectation. I might have to change my batch compile scripts to accomodate this.