Minecraft wiki entry for TNT_cannons, associated text: Even though the shot mounting blocks ladder and full block are both the same height and fire a shot at the same trajectory, the ladder will consistently fire farther than the full block because the ladder has less matter in between the shot and the charge than the full block. This situation is the same for all mounting blocks, the slab and fence post with pressure plate also follow the same rule.
There is a trade off: although the fence post and pressure plate fire the farthest, they are also expensive, while the slab is cheap and easy to get, as well as coming in many forms.
The maximum range for any cannon can be achieved by altering the mounting block. A TNT shot will be fired farthest if it leaves the cannon at a 30 degree angle. So, if you want to just have your cannon go the farthest it can, use the slab, fence and pressure plate, or trapdoor mounting blocks. However, when faced with fortifications or terrain obstacles, the best idea would be to have a mounting block like piston, ladder, or single block that makes the TNT arc over the said obstacle. But, then again, it is fun to blast your way through things...
The following shot mounting blocks are tested and deemed safe. Feel free to experiment with mounting blocks, but keep in mind that some blocks, such as a lone pressure plate, will cause a mis fire of your cannon, and of course make it self-destruct.