From 3756ca5c9c7d1bae258902577df666cd15720db4 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 12 Feb 2015 18:24:01 -0500 Subject: Against magic numbers. --- www/hacking.html.in | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'www') 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.

formatting. Be aware that if your patch seems disharmonious with what is around it, your code may be reformatted, so try to blend in.

+

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.

+

You may rely on a full POSIX and Single Unix Standard binding to the operating system.

-- cgit v1.2.1