Lines Matching +full:sound +full:- +full:name +full:- +full:prefix
18 .Sh NAME
37 Using a consistent style makes it easier for multiple people to co-operate in
71 However, UTF-8 may be used when required for accurate representation of names
75 multi-byte extended characters.
77 .St -isoC-99
82 but use sound judgment with non-ASCII characters: people should not be forced
84 UTF-8 may not be used in identifiers.
86 Generally favor ASCII-only in header files.
87 For new code, Avoid non-ASCII characters from non-UTF-8 character encodings
88 such as ISO-8859-1 or similar.
89 Pseudo-graphical line printing characters and similar glyphs are not permitted,
94 .Sq - ,
97 Non-printing characters, such as control characters
98 .Pq including form-feeds, backspace, and similar
104 characters for tabs, form-feeds, carriage returns, newlines, and so on.
110 .Bd -literal -offset indent
116 .Bd -literal -offset indent
122 An exception here may be if reading octet-oriented data where specific values
133 .Bl -bullet -offset indent
137 type and argument name.
149 .Bd -literal -offset indent
155 .Bd -literal -offset indent
156 a = (long_identifier_term1 - long_identifier_term2) *
159 .Bd -literal -offset indent
168 .Bd -literal -offset indent
179 variable name is not fit for purpose.
236 within the illumos-gate code repository.
238 Front-matter aside, comments should only contain information that is germane to
242 Discussions of non-trivial design decisions are appropriate if they aid in
245 In general, avoid including information that is likely to become out-of-date in
252 Comments should never include special characters, such as form-feed or
256 block, single-line, and trailing.
260 of a block comment that appears at the top-level of a file
268 should be in columns 2-3, so that the
276 to match all of the top-level block comments in a file.
280 .Bd -literal -offset indent
284 * and the opening slash-star and closing star-slash
289 Block comments are used to provide high-level, natural language descriptions of
295 The very first comment in a file should be front-matter containing license and
298 Following the front-matter, files should have block comments that describe
305 .Bd -literal -offset indent
329 .Bd -literal -offset indent
342 .Ss Single-Line Comments
343 A single-line comment is a short comment that may appear on a single line
345 Short phrases or sentence fragments are acceptable in single-line comments.
346 .Bd -literal -offset indent
365 of several adjacent single-line comments should
375 .Bd -literal -offset indent
382 Trailing comments are most useful for documenting declarations and non-obvious
410 with third-party compilers.
422 .Bl -bullet -offset indent
424 The length of a name should be proportional to its scope.
426 declared in a small block; an index variable used in a one-line loop might be a
434 If one uses a single character name, then use variables
445 .Pq lower-case L
483 used in identifiers for user-space programs.
484 They may be used in user-space libraries or in the kernel with some caution,
490 Trailing underscores should be similarly avoided in user-space programs.
494 a name ending in
497 .Bd -literal -offset indent
509 .Bd -literal -offset indent
523 Function-like macro names may be all CAPS or all lower case.
547 However, it is acceptable to use a name which differs only in capitalization
552 It is also acceptable to give a variable of this type a name that is the
553 all lower case version of the type name.
555 .Bd -literal -offset indent
565 .Bd -literal -offset indent
577 .Bd -literal -offset indent
583 .Bd -literal -offset indent
591 .Bd -literal -offset indent
604 .Bd -literal -offset indent
617 a naming convention, such as prefixing the name with an underscore and a tag
635 .Bd -literal -offset indent
642 when the variable names are self-explanatory or temporary:
643 .Bd -literal -offset indent
649 .Bd -literal -offset indent
657 .Bd -literal -offset indent
667 .Bd -literal -offset indent
677 .Bl -bullet -offset indent
679 Always use function prototypes in preference to old-style function
687 .Bd -literal -offset indent
693 .Bd -literal -offset indent
703 .St -isoC-99
705 .Bl -bullet -offset indent
748 .Bd -literal -offset indent
756 Struct members should be prefixed with an abbreviation of the struct name
759 Typically the first character of each word in the struct's name is used for the
760 prefix.
768 In any file which is part of a larger whole rather than a self-contained
789 so will give a compile-time error, rather than runtime data corruption.
802 non-const context.
806 Note that this means that one cannot, for example, pass a volatile-qualified
814 gives the name and a short description of what the function does.
834 the possibility of name conflicts with variables and procedures in other files.
837 .St -ansiC
870 .Bd -literal -offset indent
887 .Bd -literal -offset indent
901 while ((np = np->next) != NULL)
906 .Bd -literal -offset indent
910 * and no per-argument comments are needed.
918 .Bd -literal -offset indent
923 * per-argument comments are needed, but all argument declarations
933 .Bd -literal -offset indent
936 * Use this form when per-argument comments are needed.
968 underlying type should be typedef-ed, rather than typedef-ing a pointer to
973 .St -isoC-99
976 is preferred over the older BSD-style
981 .St -isoC-99
1006 .Bl -bullet -offset indent
1063 .St -isoC-99 ,
1075 or another standard-mandated or traditional Unix header file and be
1077 .St -isoC-99
1090 .Bl -bullet -offset indent
1122 .Bd -literal -offset indent
1123 argv++; argc--; /* WRONG */
1133 .Bd -literal -offset indent
1167 .Ic if-else
1171 .Bd -literal -offset indent
1187 .Bd -literal -offset indent
1195 .Bl -bullet -offset indent
1198 .Ic if-else
1203 .Bd -literal -offset indent
1209 .Bd -literal -offset indent
1211 sizeof ("long condition") - 1) == 0) {
1221 .Bd -literal -offset indent
1227 .Sy if, if-else, if-else if-else statements
1228 .Bd -literal -offset indent
1233 .Bd -literal -offset indent
1240 .Bd -literal -offset indent
1253 .Ic do-while
1259 .Bd -literal -offset indent
1285 .Bd -literal -offset indent
1292 .Bd -literal -offset indent
1302 .Bd -literal -offset indent
1309 .Bd -literal -offset indent
1317 .Sy do-while statements
1318 .Bd -literal -offset indent
1325 .Bd -literal -offset indent
1351 because it prevents a fall-through error if another
1355 When using the fall-through feature of
1391 .Bl -bullet -offset indent
1410 Form-feeds should never be used to separate functions.
1414 .Bl -bullet -offset indent
1431 .Bd -literal -offset indent
1436 if (strncmp(x, "done", sizeof ("done") - 1) == 0)
1450 .Sq ->
1463 .Pq Sq --
1470 .Bd -literal -offset indent
1474 strp->field = str.fl - ((x & MASK) >> DISP);
1482 .Bd -literal -offset indent
1487 .Bd -literal -offset indent
1493 .Bd -literal -offset indent
1501 when the code is printed with a pretty-printer, and may make simple regular
1504 .Bl -bullet -offset indent
1528 .Bd -literal -offset indent
1533 .Bd -literal -offset indent
1538 parameters to macros, and operator-precedence problems can arise unless
1545 Instead, give the constant a meaningful name using a
1568 .Bd -literal -offset indent
1577 to understand if a symbolic name were used for the value.
1587 .Bd -literal -offset indent
1590 if (s == -1 && errno == EINTR)
1595 .Bd -literal -offset indent
1598 } while (s == -1 && errno == EINTR);
1607 .Bd -literal -offset indent
1624 .Bd -literal -offset indent
1668 .Bd -literal -offset indent
1674 .Bd -literal -offset indent
1681 .Bd -literal -offset indent
1689 .Bd -literal -offset indent
1703 .Bd -literal -offset indent
1732 .Bd -literal -offset indent
1742 statements come out of a global preprocessor name space and can conflict with
1756 name substitution.
1766 .Bd -literal -offset indent
1782 .Bd -literal -offset indent
1792 header file's name.
1800 .Bd -literal -offset indent
1806 Be especially aware that function-like macros are textually substituted, and
1807 side-effects in their arguments may be multiply-evaluated if the arguments are
1812 For most macros and most programs, these are non-issues, but programmers who
1818 .Bl -bullet -offset indent
1835 appear well-defined can actually conceal undefined behavior.
1842 .Bd -literal -offset indent
1866 .Bd -literal -offset indent
1888 .Bd -literal -offset indent
1896 .Bd -literal -offset indent
1901 .Bd -literal -offset indent
1908 .Bd -literal -offset indent
1916 .Bd -literal -offset indent
1922 .Bd -literal -offset indent
1927 .Bd -literal -offset indent
1938 .Bl -bullet -offset indent
1942 Returns 0 for false, non-zero for true.
1957 prefix followed by a letter or number
1976 with non-boolean expressions.
1983 .Bd -literal -offset indent
1989 if (!strcmp(*argv, "-a")) /* WRONG */
1997 .Bd -literal -offset indent
2003 .Bd -literal -offset indent
2011 .Bd -literal -offset indent
2019 .Bd -literal -offset indent
2032 .Ic --
2039 .Bd -literal -offset indent
2045 Embedded assignments used to provide modest improvement in run-time
2048 .Bd -literal -offset indent
2055 .Bd -literal -offset indent
2060 In general, avoid such premature micro-optimization unless performance
2063 Be aware how in the long run hand-optimized code often turns into a
2067 whose semantics are compiler-dependent, since C's order of evaluation
2077 .Bd -literal -offset indent
2078 (x >= 0) ? x : -x