On the second point, the contract isn't unenforceable as a consequence of one party fraudulently/mistakenly attempting to give away something they are not in a position to.
If I'm the company, I take an indemnity from the developer which means I will be covered (well subject to the insurance/assets of the developer) if a previous employer attempts to assert its rights over IP I'm using. In the same way as it's the employee's decision to assign all rights, it's the company's decision to accept the assurances of the employee that the employee is in a position to assign.
If a company asserts that all employees must sign such a contract, I feel that it's pretty obvious that said company is just trying to make their contract as broad as possible to "cover all of the bases." They want to (attempt to) close all possible loopholes by essentially claiming "all your base are belong to us." How many software developers could even sign a contract that assigned over all IP rights to all IP that they ever created?
- There has to be a meeting of the minds for a contract. If a contract is tipped too far to one side, it can be said that there is no consideration. In this example, if the employee is only getting what could be considered standard market rate for their employment as a software developer, the idea that all future work in software development (even past the term of employment) will belong to the company is absurd. The company is basically saying, "after you work for us, you are no longer allowed to work for anyone else as a software developer, ever."
- It may not be possible to grant copyright over all past work because it may be owned by a previous employer.