with the advent of Machine Guns, mass charges were just plain stupid ...... 10,'s of thousands killed in a single battle
Actually, they were not stupid. The reality was that there was a state of war and the boss's knew about machine guns and rapid fire cannon with high quality, reliable ammunition and trenches. If you're a general, those are the realities you are ordered to fight. You can't go around them so, you tried to suppress them and then overwhelm a break through point and flank them. Given that leaders back home decided there will be war, that was the best they could do. At the Somme, they bombarded the line for a week, trying to find the right balance between suppression, limiting reinforcements and guess at the best moment to attack, absorb the losses and achieve the objective by a combination of suppression, movement and, yes, absorbing enough bullets to take a position and then flank.
The horror of it is just how much punishment men could take when they had no other choice, the bombing, the becoming subterranean beasts, all tended to overcome the best of plans. Point is that, given what it was, if 10,000 men shot meant 100,000 flooded though and flanked the enemy and won the war, it was deemed worth it and, if war it was, there really was no other choice. Lincoln called it the 'awful math' and Grant got it. If it is war, then that means killing.