What's That Thing on The End?
Gun banners often seem to get highly excited by things they see attached to the barrels of guns. Mostly due to ignorance and misunderstanding terminology.
Probably the most commonly misunderstood is the flash-hider. This does not, as some assume, hide the flash of a gun firing to obscure where they are shooting from. During daylight hours, the flash is pretty much obscured by daylight anyway. Its purpose is to control the direction of the burning gasses. Without a flash hider there is what looks like a huge fireball of flame. In dim light this is bright enough to destroy the shooter's night vision. The flash hider works by making the gasses "swirl" giving better combustion and keeping the gas from ballooning outwards. The flash hider typically attached to an AR15 (image below) is constructed with no vents on the under-side. The purpose is to help prevent muzzle blast going downwards when shooting prone, and blowing up dust, twigs, leaves etc.
A secondary benefit of a flash hider is that it is a cheap way to protect the end (crown) of the barrel. The carefully machined crown is essential to accuracy. Any damage, even minor, can severely affect accuracy of the gun.
Another commomn attachment is a muzzle brake. Superficially it might look a bit like a flash-hider, but a bit closer observation will reveal that it is not completely open like a flash hider. The end is closed with a small hole just large enough for the bullet, and there may be (probably are) one or more similar baffles internally:
The muzzle brake acts to force the gas exiting the barrel to flow outwards, and backwards, effectively pulling the gun forwards. This counteracts at least a portion of the recoil. Often, as in the example shown above, there are vents on the top side, these direct gas upwards to help to counteract the tendency of older design guns (non AR-15 style) to flip upwards due to the unaligned forces of recoil.
These are typically found on larger caliber guns, which produce more recoil.
One rather unpleasant side-effect of muzzle brakes is that in re-directing a lot of the muzzle blast outwards and backwards the sound is greatly amplified for the shooter and anyone alongside him.
Handguns also exhibit recoil and upwards-flip effects. Some competition shooters use guns with ported barrels that achieve the same effect as a muzzle brake. With semi-automatic designs this often also involves making cut-outs in the slide to allow the gas to escape: