The problem is if you have a permit for anything related to a sleeping space, you will be coming up to that code. You are actually dealing with multiple codes too. You have the life safety portion of the building code (NFPA 72/NFPA 101) and the electric code. These days most states are using a model code like the ICC to write theirs (driven by insurance companies) so things like smoke detector placement and requirements tend to be the same across the country. If your insurance company is not looking, older homes may not comply to any of this but those people are becoming more intrusive, particularly if you are changing companies.