It may be of interest to know that in WWII in the European Theater U.S. tank crewman were not issued ANY personal weapon. The idea being that they wouldn't need one inside a tank. Naturally, the soldiers made sure to obtain a weapon by any means as soon as possible. Later, the M-3 submachinegun became available and racks were welded inside the tank to secure those guns.
I am a former U.S. tank man. We were issued with pistols (m1911) and we also had two M-3 SMGs in the tank.
If a tank is hit or disabled it may be necessary to get out and get out quick! So a pistol attached to the body is about the only realistic option. However, sometimes you have to stand security watch around the tank laager and a shoulder weapon is very welcome.
U.S. tank crewman today are trained with the pistol and also the M-4 carbine.