How to tell machine how far travel limits without switches
Since 3D printers works with coodinates and the gcode generator requires the origin point and bed shape and bed size. knowing this your programs never will be out of the printing area.

My printer has a printing area of 16.5 x 16.5 cm, so I set this parameter to CURA, Slic3r and 3dsimplify and I can't generate the gcode if the part does not fit on the bed. So I print parts with 15cm maximum

Also the firmware has this limits to 16cm, the 0.5 cm is just for safety

Of course if I send a command with pronterface or any other gbrl controler I can go over the limits due the X0Y0 could be out of position (offset), but if you respect the origin point and don't try to go over the limits by yourself the machine will be ok.