Lines Matching +full:foo +full:- +full:supply
28 Now, some people will claim that having 8-character indentations makes
30 80-character terminal screen. The answer to that is that if you need
34 In short, 8-char indents make things easier to read, and have the added
40 instead of "double-indenting" the "case" labels. E.g.:
87 with a long argument list. However, never break user-visible strings such as
103 This applies to all non-function statement blocks (if, switch, for,
126 is ... well ... inconsistent, but all right-thinking people know that
132 ie a "while" in a do-statement or an "else" in an if-statement, like
136 body of do-loop
151 Also, note that this brace-placement also minimizes the number of empty
153 supply of new-lines on your screen is not a renewable resource (think
154 25-line terminal screens here), you have more empty lines to put
182 function-versus-keyword usage. Use a space after (most) keywords. The
209 = + - < > * / % | & ^ <= >= == != ? :
212 & * + - ~ ! sizeof typeof alignof __attribute__ defined
215 ++ --
218 ++ --
220 and no space around the '.' and "->" structure member operators.
237 C is a Spartan language, and so should your naming be. Unlike Modula-2
243 HOWEVER, while mixed-case names are frowned upon, descriptive names for
244 global variables are a must. To call a global function "foo" is a
252 Encoding the type of a function into the name (so-called Hungarian
253 notation) is brain damaged - the compiler knows the types anyway and can
259 Calling it "loop_counter" is non-productive, if there is no chance of it
260 being mis-understood. Similarly, "tmp" can be just about any type of
264 problem, which is called the function-growth-hormone-imbalance syndrome.
303 NOTE! Again - there needs to be a _reason_ for this. If something is
313 type-checking.
322 Therefore, the Linux-specific 'u8/u16/u32/u64' types and their
324 permitted -- although they are not mandatory in new code of your
353 case-statement, where you have to do lots of small things for a lot of
357 less-than-gifted first-year high-school student might not even
360 descriptive names (you can ask the compiler to in-line them if you think
361 it's performance-critical, and it will probably do a better job of it
365 shouldn't exceed 5-10, or you're doing something wrong. Re-think the
396 - unconditional statements are easier to understand and follow
397 - nesting is reduced
398 - errors by not updating individual exit points when making
400 - saves the compiler work to optimize redundant code away ;)
408 return -ENOMEM;
425 Comments are good, but there is also a danger of over-commenting. NEVER
439 When commenting the kernel API functions, please use the kernel-doc format.
440 See the files Documentation/kernel-doc-nano-HOWTO.txt and scripts/kernel-doc
444 Don't use C99-style "// ..." comments.
446 The preferred style for long (multi-line) comments is:
449 * This is the preferred style for multi-line
454 * with beginning and ending almost-blank lines.
465 That's OK, we all do. You've probably been told by your long-time Unix
469 typing - an infinite number of monkeys typing into GNU emacs would never
475 (defun c-lineup-arglist-tabs-only (ignored)
477 (let* ((anchor (c-langelem-pos c-syntactic-element))
478 (column (c-langelem-2nd-pos c-syntactic-element))
479 (offset (- (1+ column) anchor))
480 (steps (floor offset c-basic-offset)))
482 c-basic-offset)))
484 (add-hook 'c-mode-common-hook
487 (c-add-style
488 "linux-tabs-only"
489 '("linux" (c-offsets-alist
490 (arglist-cont-nonempty
491 c-lineup-gcc-asm-reg
492 c-lineup-arglist-tabs-only))))))
494 (add-hook 'c-mode-hook
496 (let ((filename (buffer-file-name)))
499 (string-match (expand-file-name "~/src/linux-trees")
501 (setq indent-tabs-mode t)
502 (c-set-style "linux-tabs-only")))))
505 files below ~/src/linux-trees.
510 Now, again, GNU indent has the same brain-dead settings that GNU emacs
515 options "-kr -i8" (stands for "K&R, 8 character indents"), or use
519 re-formatting you may want to take a look at the man page. But
536 logging of avc messages output). Does not do system-call
556 Documentation/kbuild/kconfig-language.txt.
561 Data structures that have visibility outside the single-threaded
568 users to have access to the data structure in parallel - and not having
582 Examples of this kind of "multi-level-reference-counting" can be found in
603 Macros with multiple statements should be enclosed in a do - while block:
615 #define FOO(x) \
618 return -EBUGGERED; \
626 #define FOO(val) bar(index, val)
631 3) macros with arguments that are used as l-values: FOO(x) = y; will
632 bite you if somebody e.g. turns FOO into an inline function.
666 that's automatic. Many subsystems have Kconfig options to turn on -DDEBUG.
721 failed. Such a value can be represented as an error-code integer
722 (-Exxx = failure, 0 = success) or a "succeeded" boolean (0 = failure,
723 non-zero = success).
726 difficult-to-find bugs. If the C language included a strong distinction
732 the function should return an error-code integer. If the name
736 for success or -EBUSY for failure. In the same way, "PCI device present" is
746 this rule. Generally they indicate failure by returning some out-of-range
751 Chapter 17: Don't re-invent the kernel macros
762 #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
775 -*- mode: c -*-
781 compile-command: "gcc -DMAGIC_DEBUG_FLAG foo.c"
802 ISBN 0-13-110362-8 (paperback), 0-13-110370-9 (hardback).
803 URL: http://cm.bell-labs.com/cm/cs/cbook/
807 Addison-Wesley, Inc., 1999.
808 ISBN 0-201-61586-X.
809 URL: http://cm.bell-labs.com/cm/cs/tpop/
811 GNU manuals - where in compliance with K&R and this text - for cpp, gcc,
815 language C, URL: http://www.open-std.org/JTC1/SC22/WG14/