You could, conceivably simply put your copyright notice that mentions a LICENSE file, however there is no guarantee that once released, your code will remain atomic. In fact, it is quite likely that bits and pieces of it will be remixed in at least several other projects.
This is why it is important to at least have the following in every source file:
/* Copyright (C) 1883 Thomas Edison - All Rights Reserved
* You may use, distribute and modify this code under the
* terms of the XYZ license, which unfortunately won't be
* written for another century.
* You should have received a copy of the XYZ license with
* this file. If not, please write to: , or visit :
You accomplish two things by doing this:
- Your copyright is asserted no matter how your code disintegrates and scatters in the future.
- You make the terms of using, distributing and modifying it quite clear, even if someone happened to receive only a small part of a library that you wrote.
A lot of people also include their e-mail address under the copyright, which is helpful for receiving patches in the future. I received a patch last month for code that I wrote five years ago and had long forgotten about. Of course, that means maintaining an e-mail address and putting up with a bit of SPAM.
If ever you actually need to enforce your license, it is critical that the other party can't say that the terms were ambiguous or missing, all kidding aside.
Plus, it's fun to watch how bits and pieces of your code find their way into other bits and pieces of code over time. Most people play fair and respect copyright and license terms.