The answer is that it depends largely on the age and style of the gun.
You don't want to be dry-snapping rim-fire guns (mostly 22's) for obvious reasons.
In the case of normal center-fire weapons, you have to consider advances in metallurgy over the last century.
Military surplus weapons like Mausers made prior to WW-II can be hurt by dry-snapping, particularly the firing pins can be hurt. I don't know exactly where the dividing line is but anything modern, say, made after 1980 or thereabouts, is not going to be hurt by dry snapping.
If it’s a centerfire with hammer, generally won’t hurt the firearm. If it uses a firing pin (.380 semi, etc), don’t do it. You can damage the firing pin.
Actually, there are two eras of Mauser metallurgy to worry about. Prior to WWII, springs and pins could be excessively brittle. After about 1942, I don’t trust the heat treating in the receiver or bolt. The slave labor in the Nazi war machine was either very sloppy about heat treating, or they were using defective heat treating as a lovely future “gift” to their Nazi hosts. I’ve seen some Mauser receivers be dead soft and some be so hard it is a wonder they didn’t shatter.