Well... it's sad but it's true... That's what we call capitalism ;-)
I come from Poland (Europe) and here we have the same (and as a matter of fact - i'm not a lawyer). As ussually everything is in a contract you sign (everything what is not forbiden is acceptable :->), but i've never had heard about anybody here in situation like this.
I have a comfortable situation - i work for a company as a 'hourly' employee. During that time i work for the company - meeting clients, programming for them (clients), etc. The whole thing is that my company allows me to work for clients (i've met during my hourly employement) when i finish my work and go home... and then the company has nothing to do with that - it was my free time. My contract says nothing about that kind of work.
Nearly the same thing is with the code - i can write anything i want and release that code as long as it's not a part of the code i create for a company, and in my case it's a matter of trust and company culture rather than any paper i signed.
Situation in Poland:
Following the intellectual property law, everything you code (create) while working for your employer belongs to him, becouse you are implementing his project or doing what the contract says.
On the other hand, you are the author of the code and still have some rights...
BTW. Sorry for my english :)