As old as the GNU GPL is, I'm amazed at how broadly it is still misunderstood.
Three lines of code is not going to make a difference. I could write a simple for()
loop with three lines of code and you'd probably spot it in hundreds of code bases. Your question is valid, but the example is rather trivial.
If Microsoft accidentally linked against a GPL'ed (note, I said GPL, not LGPL) library, there would be an issue because they would have created a combined work. Microsoft could come into compliance by either:
Your last question was the most interesting part, and yes all software companies should be diligent about monitoring what gets checked into their code base. Some companies even appoint 'compliance officers' to ensure that their use of free/open source code is in accordance with the license. One of the benefits of version control is to be able to monitor this.
If you have proprietary code, in an ideal world, you use open stuff that is under the least restrictive licenses such as the two / three clause BSD, MIT or similar.
IANAL, but I work closely with one. Part of my job is to ensure my company remains compliant, it's my ultimate call on what third party stuff we use.