Do copyright notices need to be placed at the beginning of a file?
<p>I'm a student and won't be publishing code any time soon, but I am working on improving the composition of my code. I'm interested in open source and I've only seen copyright notices and license text at the very beginning of files.</p>

<p>If I place the copyright later in the file, say, after the synopsis, or even at the end of the file, would someone misusing my code be able to get away with saying: "Oh, well you're supposed to put the copyright at the beginning, its not fair to expect me to go looking around for it".</p>

<p>Textbooks also put copyrights before the table of contents, which I think is weird because if I was looking in a book for specific information (the copyright), the first place I would look would be the table of contents, to see which page to turn to, but then it isn't always listed.</p>

<p>Basically, are there any hard rules about where I'm allowed/not allowed to place copyright notices and other legal info?</p>

<p><strong>Edit:</strong></p>

<p>I actually really like all the answers, but this paragraph in David Schwartz's answer tells me what I feel like my brain should have realized before asking the question in the first place:</p>

<blockquote>
  <p>Rights separated by copyright law include making copies, distributing to the public, performing in public, making creative follow on works, and so on. <strong>These are things you always need the copyright holder's permission to do and if you can't get it for any reason, you simply can't do those things.</strong></p>
</blockquote>

<p>Under the Berne Convention, a copyright notice is not required at all, although using one is good practice. Using one usually eliminates the claimed status of "innocent infringement", which, if found true by a court, greatly reduces damage awards. </p>

<p>It is usual to place such notices at or near the start of a work. That is where people tend to look for them, and I don't see any good reason not to follow this practice. The book tradition is the the copyright page comes before any part of the actual work, including the table of contents, sometimes with a continuation at the end of the work, if there is more than one page of notices.  But that is not now a legal requirement, if it ever was.</p>

<p>In short, there are no rigid rules on this, but putting a copyright notice at or quite near the start is good practice, and I would suggest sticking to it. </p>

<blockquote>
  <p>If I place the copyright later in the file, say, after the synopsis, or even at the end of the file, would someone misusing my code be able to get away with saying: "Oh, well you're supposed to put the copyright at the beginning, its not fair to expect me to go looking around for it".</p>
</blockquote>

<p>Either the person "misusing" your code is doing something they are allowed to do under copyright law or they are doing something they need the copyright holder's permission to do under copyright law.</p>

<p>A copyright notice can't take away any rights anyone already has. A book can't have a copyright notice that says, "By the way, you may not read this book on Sundays". A mere notice can't take away anyone's rights.</p>

<p>So if they're doing something they don't need special permission to do under copyright law, then that's the end of it. It doesn't matter what the copyright notice says if you're doing something copyright law allows you to do anyway.</p>

<p>But what if they're doing something they're not allowed to do under copyright law without permission of the copyright holder? Then how would them saying they didn't see the copyright notice change anything? They would just be admitting that they had no reason to think they had a license or other permission to do something that the law requires them to get permission to do.</p>

<p>The structure of copyright law is as follows: Normally, if you own something, you can pretty much do whatever you want with it. Without copyright law, if I owned a book, I could read it, copy it, perform it in public, or otherwise do pretty much anything except throw it at someone else's head.</p>

<p>Copyright law changes this. Copyright law sets aside specific things that are not rights of possession. It separates the physical possession of a book from the right to make copies of the creative contents of that book. The things that copyright law separates from rights of possession then become things you need the copyright holder's permission to do, regardless of your physical possession of copies of a work.</p>

<p>Anything not separated from rights of possession by copyright law are rights that anyone who legally possesses the work may exercise. For examples, US law does <em>not</em> separate use. So anyone who lawfully possesses a copyrighted work may use it in the ordinary way. So you don't need permission to read a book you own or watch a DVD you own.</p>

<p>Rights separated by copyright law include making copies, distributing to the public, performing in public, making creative follow on works, and so on. These are things you <em>always</em> need the copyright holder's permission to do and if you can't get it for any reason, you simply <em>can't</em> do those things.</p>

<p>Copyright notices really only do two things:</p>

<ol>
<li><p>They inform people who the copyright holder is. This can be helpful if you're trying to contact the copyright holder to get additional rights.</p></li>
<li><p>They can offer additional rights that you wouldn't otherwise have. For example, a copyright notice can include permission to make copies or permission to perform the work in public.</p></li>
</ol>

<p>But that's about it. Copyright notices are not required and they cannot take any rights away. Nobody is under any obligation to read them or consider them if they don't want to. They are not binding on anyone but the person who wrote the notice.</p>

<p>Not a lawyer, but I did spent 3 minutes in a law school building asking directions once.  Oh, and a big advocate for F/OSS software.</p>

<p>I do not think there is a requirement for the license to be at the top.  However, that is the expected location, and an accepted convention.  As you probably know, most IDEs can be configured to insert a default block of text at the top of the file just for author/copyright/license info.</p>

<p>The GNU folk on their "How to use" page at <a href="https://www.gnu.org/licenses/gpl-howto.en.html" rel="nofollow noreferrer">https://www.gnu.org/licenses/gpl-howto.en.html</a>  give a few good points as to why it should be included in each and every file, and several of those reasons lead to why it is best to have it at the top of the file.  I'd recommend reading over the entire document, as well as the linked documents at the top that may help you pick the appropriate version of the GPL for your needs and wants.</p>

<blockquote>
  <p>However, programmers often copy source files from one free program
  into another. If a source file contains no statement about what its
  license is, then moving it into another context eliminates all trace
  of that point. This invites confusion and error.</p>
</blockquote>

<p>Programmers also often start at the top of the file to get any required includes/imports, etc. and then chop out whatever methods/functions they want to move over - with your copyright notice and license info at the top, it is quite clear and the next developer won't accidentally leave it out, etc.  </p>

<p>I recall reading that the legal disclaimer of warranty/liability (<code>THIS SOFTWARE IS PROVIDED "AS-IS" ...</code>) should be placed prominently (including being upper case) to maximise the chance of standing up in court. Perhaps someone could confirm this. Certainly the <a href="https://www.gnu.org/licenses/gpl-howto.html" rel="nofollow noreferrer">"GPL How-To"</a> makes it very clear that the licence should be at the top of the file. At any rate it makes sense to put the copyright notice in the same place.</p>

<p>Due to the nature of open-source <strong>it is common for individual files to be copied into other projects</strong> and so having a file's copyright holders and licence terms within each file is good practice. </p>

<p>What I'm doing with my code currently is placing a small comment at the top of the file saying:</p>
<pre><code> // For intellectual property information see comment-sections at the end of the file.   
</code></pre>
<p>That way, I can devote a large section of the file content to copyrights and other intellectual property information at the end of the file, yet make it easy for whoever reads the file to quickly see and understand the code it contains and how to use it.</p>
<p>I'm not a lawyer, but a programmer, so I like this way better. Since copyright notices are not legally required, and thus only serves an informational purpose, I think this should be enough. But I'm not a lawyer, so if someone knows this is not enough, I would welcome their opinion.</p>

open-source-software copyright-notice