| History log of /src/share/misc/style |
| Revision | | Date | Author | Comments |
| 1.77 |
| 29-Jan-2024 |
rin | style: One more typo, NFC
|
| 1.76 |
| 24-Jan-2024 |
rin | style: Fix typo, NFC
"it it" --> "it is" (across a newline)
|
| 1.75 |
| 07-Aug-2023 |
riastradh | style(5): Advise against new struct typedefs and explain why.
Proposed on tech-kern: https://mail-index.netbsd.org/tech-kern/2023/07/11/msg028950.html
Positive feedback to general concept, negative feedback to specifics and phrasing of the first iteration but no objections to latest iteration after several weeks at: https://mail-index.netbsd.org/tech-kern/2023/07/16/msg028994.html
|
| 1.74 |
| 21-Apr-2023 |
rillig | style: remove mentions of ANSI C
The distinction between traditional C and ISO C90 or later is no longer needed in the style guide. Any old-style code is caught by the compilers.
https://mail-index.netbsd.org/tech-userlevel/2023/04/15/msg013768.html https://mail-index.netbsd.org/tech-userlevel/2023/04/17/msg013776.html
|
| 1.73 |
| 17-Apr-2023 |
dholland | share/misc/style: Don't prescribe using "extern.h" for all prototypes.
That's very 80s.
No objection (or even response, amazingly enough) on tech-userlevel in two weeks.
|
| 1.72 |
| 15-Apr-2023 |
rillig | style: fix spelling of plural parentheses
|
| 1.71 |
| 14-Apr-2023 |
rillig | style: don't require sorting variables in functions
Sorting the variables by size would be platform-dependent and thus is not possible.
Sorting the variables alphabetically may or may not make the code easier to read, and the example given below that rule doesn't follow it, otherwise the correct order would be 'eight, eleven, nine, ten, thirteen, twelve'.
https://mail-index.netbsd.org/tech-userlevel/2023/04/11/msg013749.html
|
| 1.70 |
| 11-Apr-2023 |
riastradh | style(5): Omit redundant proscription against .c externs in previous.
|
| 1.69 |
| 30-Mar-2023 |
riastradh | style(5): Forbid extern in .c files.
Discussed on tech-userlevel (bcc tech-kern): https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html
|
| 1.68 |
| 14-Feb-2023 |
jschauma | exit with EXIT_FAILURE, not 1, as elsewhere
|
| 1.67 |
| 30-Dec-2022 |
jkoshy | Move a style recommendation closer to the syntax that it describes.
|
| 1.66 |
| 30-Dec-2022 |
jkoshy | C99: Suggest using narrow scopes for loop indices.
|
| 1.65 |
| 29-Dec-2022 |
jkoshy | Terminate a sentence with a full stop.
|
| 1.64 |
| 10-Mar-2022 |
rillig | share/misc/style: lint no longer needs CONSTCOND in do-while-loops
Since usr.bin/xlint/lint1/tree.c 1.202 from 2021-01-31, lint recognizes the common idiom 'do { ... } while (0)' and no longer complains about its constant condition; see tests/usr.bin/xlint/lint1/msg_161.c.
|
| 1.63 |
| 10-Mar-2022 |
rillig | share/misc/style: clarify enum example code
The only purpose of the enum example is to show that enum constants are written in uppercase.
The previous code could be mistakenly interpreted as requiring each definition of an enum type to also define a global variable of that type, and to make the variable name the abbreviated type name. Even if the enum type were prefixed with 'typedef', choosing different names for the tag and the typedef would not be necessary.
To avoid these possible misinterpretations above, remove the variable name from the declaration.
|
| 1.62 |
| 28-Mar-2021 |
christos | Clarify and explain the rationale for parentheses in sizeof and return as discussed.
|
| 1.61 |
| 28-Mar-2021 |
christos | - EXIT_FAILURE instead of 1 - %j instead of PRI for *intmax_t - != -1 instead of < 0 for syscalls
|
| 1.60 |
| 29-Nov-2020 |
rillig | style: fix typo
|
| 1.59 |
| 02-Aug-2020 |
riastradh | Remove confusing advice about macros that might expand to nothing.
Such macros should not exist; as advised earlier in the file, they should expand to `__nothing' (literally) from <sys/cdefs.h> which itself expands to ((void)0) precisely so that the problem this advice sought to avoid does not arise.
|
| 1.58 |
| 02-Aug-2020 |
riastradh | Update style around single-line braces according to discussion.
https://mail-index.netbsd.org/tech-userlevel/2020/07/12/msg012536.html https://mail-index.netbsd.org/tech-kern/2020/07/12/msg026594.html
Retain some examples of technically unnecessary braces that likely aid legibility from the previous commit.
|
| 1.57 |
| 02-Aug-2020 |
lukem | style: revert previous
I misintepreted the consensus.
|
| 1.56 |
| 01-Aug-2020 |
lukem | style: prefer braces for single statement control statements
Prefer to use { braces } around single statements after control statements, instead of discouraging them.
Per discussion on tech-userlevel & tech-kern, where the significant majority of developers who responded (including current and former core members) prefer this new style.
|
| 1.55 |
| 26-Jul-2020 |
rillig | style: fix typo about enum constants being capitalized
|
| 1.54 |
| 28-Jan-2019 |
christos | document how we want to use __nothing
|
| 1.53 |
| 23-May-2016 |
salazar | branches: 1.53.16; fix spelling mistakes
|
| 1.52 |
| 24-Oct-2015 |
christos | Amend variable initialization in the declarations comment.
|
| 1.51 |
| 08-Mar-2013 |
christos | PR/47632: Supratim Chakraborty: Spelling Mistake for Variadic functions
|
| 1.50 |
| 27-Jun-2012 |
riastradh | branches: 1.50.2; Elaborate and clarify rules about #include order.
ok christos
|
| 1.49 |
| 01-Sep-2011 |
christos | branches: 1.49.2; explain NULL casts
|
| 1.48 |
| 27-Aug-2011 |
joerg | Prototyping main is silly and shouldn't be encouraged.
|
| 1.47 |
| 30-Oct-2010 |
christos | make usage dead.
|
| 1.46 |
| 24-Apr-2010 |
christos | Be explicit about sizeof(*var) being preferred over sizeof(type).
|
| 1.45 |
| 15-Feb-2009 |
dholland | Avoid trailing whitespace. It is definitely against the style rules.
|
| 1.44 |
| 09-Sep-2008 |
jschauma | branches: 1.44.4; move punctuation of a complete sentence into its parens
|
| 1.43 |
| 20-Jul-2008 |
lukem | Remove the \n from the __COPYRIGHT example; what(1) stops extracting at them, so we lose most of the message.
|
| 1.42 |
| 16-Feb-2008 |
apb | branches: 1.42.4; 1.42.8; Don't mention <machine/int_fmtio.h>; code should just include <inttypes.h> to get intmax_t, PRIdMAX, and friends.
|
| 1.41 |
| 20-Sep-2007 |
plunky | getopt uses : when an argument is expected
|
| 1.40 |
| 26-May-2007 |
christos | branches: 1.40.4; Fix reversed test and missing +; from Joerg Niendorf
|
| 1.39 |
| 13-Apr-2007 |
darcy | Add entry about making include files self-sufficient.
|
| 1.38 |
| 02-Nov-2006 |
christos | update brace comments to reflect current reality.
|
| 1.37 |
| 25-Feb-2006 |
wiz | Mention the preferred option order in getopt(), usage(), and man page. Suggest describing newly added options in usage() and man page.
|
| 1.36 |
| 25-Aug-2005 |
briggs | Add some comments about using inttypes.h / int_fmtio.h macros. Show use of PRIdMAX, PRIxMAX, PRId64, PRIx32, and refer to SCN*. Inspired by comments from Roland Illig and others.
|
| 1.35 |
| 20-Aug-2005 |
rillig | Partly reverted my last change. I had forgotten that off_t is a signed data type.
|
| 1.34 |
| 20-Aug-2005 |
rillig | Don't cast unsigned values to long long. They might overflow.
|
| 1.33 |
| 20-Aug-2005 |
rillig | Use exit(EXIT_FAILURE) instead of exit(1).
|
| 1.32 |
| 10-Jun-2005 |
junyoung | More clarification on uintN_t.
|
| 1.31 |
| 03-Feb-2005 |
christos | Make comment more specific.
|
| 1.30 |
| 02-Feb-2005 |
christos | fix accidental join that made the comment look like functions that return ``void *'' should not be cast'ed.
|
| 1.29 |
| 01-Feb-2005 |
christos | Add missing (void) cast to printf return. Prefer returning from main rather than calling exit.
|
| 1.28 |
| 03-Jan-2005 |
wiz | Add uint32_t as example (so that it is implicitly clear we prefer the C99 types).
|
| 1.27 |
| 27-Sep-2003 |
simonb | Use uintN_t in code example instead of u_intN_t. Agrees with current standards (and more importantly Klaus too :-).
|
| 1.26 |
| 05-Aug-2003 |
jmmv | Recommend EXIT_SUCCESS and EXIT_FAILURE for exit status, instead of directly using 0 and 1 values, respectively.
|
| 1.25 |
| 17-Apr-2003 |
lukem | check strtol for ERANGE overflow too...
|
| 1.24 |
| 10-Mar-2003 |
lukem | There's no need anymore to protect __COPYRIGHT() and __RCSID() with: #ifndef __lint ... #endif
|
| 1.23 |
| 04-Mar-2003 |
fvdl | Return value style update (no parentheses)
|
| 1.22 |
| 02-Mar-2003 |
jhawk | Amend rev 1.21: there is insufficient concensus on #define<TAB>. Permit any whitespace after #define, but mandate consistency of TABs within a file.
|
| 1.21 |
| 23-Feb-2003 |
jhawk | Clarify that macros should be #define<TAB>; it's important to specify this in the actual document, just not in the cvs logs (cf. rev 1.15).
|
| 1.20 |
| 23-Oct-2001 |
kleink | branches: 1.20.2; Inspired by rev. 1.18: consistency, pull in <assert.h> for _DIAGASSERT().
|
| 1.19 |
| 23-Oct-2001 |
kleink | As discussed with Luke, add a short _DIAGASSERT(3) example. Fixes PR lib/14324.
|
| 1.18 |
| 21-Feb-2001 |
cgd | add include of stdlib.h, for use of setprogname() & getprogname()
|
| 1.17 |
| 19-Feb-2001 |
cgd | nuke __progname, suggest setprogname() and getprogname()
|
| 1.16 |
| 06-Sep-2000 |
enami | Fix typos.
|
| 1.15 |
| 04-Sep-2000 |
lukem | - fix spelo - be consistent with #define<TAB> for macros
|
| 1.14 |
| 10-Mar-2000 |
lukem | add example on how to printf 64 bit quantities
|
| 1.13 |
| 10-Mar-2000 |
lukem | fix comment around CONSTCOND
|
| 1.12 |
| 02-Mar-2000 |
lukem | major overhaul: * require ANSI not K&R for prototypes, stdargs, etc * document current practice for - rcsids & copyright - header file inclusion protection - expressions, and multi-statement macros - enum & struct decls - empty and large statements - wrapping long lines, prototypes, function decls
|
| 1.11 |
| 03-Jul-1999 |
abs | Fix error in example - from VaX#n8 <vax@linkdead.paranoia.com>
|
| 1.10 |
| 29-Jan-1999 |
scottr | Add a pointer to the indent(1) profile, and a disclaimer regarding same.
|
| 1.9 |
| 20-Jan-1999 |
lukem | provide a better parenthesis example. from Brian Grayson in [misc/6714]
|
| 1.8 |
| 01-Sep-1998 |
simonb | Function type declarations are manatory now.
|
| 1.7 |
| 09-Feb-1998 |
enami | Make C sentense end with `;'.
|
| 1.6 |
| 30-Aug-1996 |
thorpej | RCS id police. Side effect: shows the RCS id style we prefer :-)
|
| 1.5 |
| 31-Mar-1996 |
scottr | getopt() returns -1 when the arg list is exhausted, not EOF. Ironic that it should show up here...
|
| 1.4 |
| 10-Apr-1995 |
briggs | Minor grammatical nit: "have too" -> "have to."
|
| 1.3 |
| 19-Dec-1994 |
cgd | s/externs.h/extern.h/
|
| 1.2 |
| 26-Mar-1994 |
cgd | style guide
|
| 1.1 |
| 06-Aug-1993 |
cgd | overall source code style guide. it is king. revere it.
|
| 1.20.2.1 |
| 02-Jun-2003 |
tron | Pull up revision 1.23 (requested by mason in ticket #1191): Return value style update (no parentheses)
|
| 1.40.4.2 |
| 23-Mar-2008 |
matt | sync with HEAD
|
| 1.40.4.1 |
| 06-Nov-2007 |
matt | sync with HEAD
|
| 1.42.8.1 |
| 18-Sep-2008 |
wrstuden | Sync with wrstuden-revivesa-base-2.
|
| 1.42.4.1 |
| 05-Oct-2008 |
mjf | Sync with HEAD.
|
| 1.44.4.1 |
| 13-May-2009 |
jym | Sync with HEAD.
Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
|
| 1.49.2.2 |
| 22-May-2014 |
yamt | sync with head.
for a reference, the tree before this commit was tagged as yamt-pagecache-tag8.
this commit was splitted into small chunks to avoid a limitation of cvs. ("Protocol error: too many arguments")
|
| 1.49.2.1 |
| 30-Oct-2012 |
yamt | sync with head
|
| 1.50.2.1 |
| 23-Jun-2013 |
tls | resync from head
|
| 1.53.16.1 |
| 10-Jun-2019 |
christos | Sync with HEAD
|