I think it was an attempt a few decades ago Sam, to try and ensure peace worldwide and to halt the proliferation of nuclear weapons.
Most, at the time, non nuclear countries signed up to an agreement not to develop nuclear weapons, probably in exchange for bucketloads of cash from the western governments to help develop their countries.
Also remember that the original nuclear powers, the USA, The UK and even Russia would probably not initiate a nuclear attack. The more backward and unstable countries such as Pakistan, India, China, Korea and the Arab countries dont seem to have the same moral code as the earlier nuclear powers and are more like a ticking time bomb.
Afterall you wouldnt let a child play with a box of matches would you