Creative Commons specifically recommends that its licenses not be used for software, and I am aware that discussions occur frequently on this topic. Users often come to the site seeking a solution, and when that solution is posted they will then copy it to their own code, but that requires them to license their software under CC-BY-SA.
The solution? All program code posted to Stack Overflow should be licensed by default under a license that permits its free use in software. I would recommend the Mozilla Public License, version 2.0, which still provides some copyleft protection but is fairly easy to understand. Also note that the MPL explicitly grants you the right to display the code, something that could be useful for posting on other websites. Of course, the poster would have the right to choose another license if they wished.
Of course, we can't change any of the code that's already been posted to SO. It's under CC-BY-SA, and the copyleft can't be broken. So some code-marking system would have to be developed to mark pre-change and post-change code.