That's why navies stopped using broadsides and went to turrets about 150 years ago. Well, it's one of the reasons anyway. Turrets also worked a lot better once you shifted to steam power and didn't have to worry so much about rigging. Additionally, you could mount a much bigger gun on a turret than you could using broadsides on the sides of a wooden sailing ship.
Turrets also prevent what happened to the Vasa, which was the most powerful sailing ship of its time. Its time being 10th August 1626, from 3:40 pm to four o'clock. The king of Sweden ordered it to be made longer, halfway through building it. This scope creep turned out to have negative implications vis-a-vis keeping the gun ports above the waterline.