diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2015-02-12 18:24:01 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2015-02-12 18:24:39 -0500 |
commit | 3756ca5c9c7d1bae258902577df666cd15720db4 (patch) | |
tree | 6e0a9ae411e1e86faf2aa3a0aa75c14e34c151db /www | |
parent | df9232c655921ed37083c9509940fdb52b8f70fa (diff) | |
download | gpsd-3756ca5c9c7d1bae258902577df666cd15720db4.tar.gz |
Against magic numbers.
Diffstat (limited to 'www')
-rw-r--r-- | www/hacking.html.in | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/www/hacking.html.in b/www/hacking.html.in index 14fb6800..0cd9d114 100644 --- a/www/hacking.html.in +++ b/www/hacking.html.in @@ -501,6 +501,15 @@ uClibc. Instead, rely on what POSIX guarantees.</p> formatting. Be aware that if your patch seems disharmonious with what is around it, your code may be reformatted, so try to blend in.</p> +<p>Do not litter the code with undocumented magic numbers! This is +especially important for buffer lengths, because unsynchronized +changes to buffer lengths and the code that uses them can result in +overruns and all mamnner of nastiness. If a magic number occurs once, +a comment near the point of occurrence should explain why it has the +value it does. If it occurs multiple times, make it the value of +a macro that is defined in one place so that all instances can be +changed sanely.</p> + <p>You may rely on a full POSIX and Single Unix Standard binding to the operating system.</p> |