| Summary: | duplication in style.9 | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Documentation | Reporter: | Alex Kapranoff <alex> | ||||
| Component: | Books & Articles | Assignee: | freebsd-doc (Nobody) <doc> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | Latest | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
State Changed From-To: open->closed Committed, thanks. |
style.9 manpage recomends against declaring functions inside other functions two times. Look: STYLE(9) FreeBSD Kernel Developer's Manual STYLE(9) NAME style - Kernel source file style guide [skip] When declaring variables in functions declare them sorted by size, then in alphabetical order; multiple ones per line are okay. Declaring func- tions inside functions is not recommended, since their linkage scope is always global. If a line overflows reuse the type keyword. Be careful to not obfuscate the code by initializing variables in the declarations. Use this feature only thoughtfully. DO NOT use function calls in initializers! struct foo one, *two; double three; int *four, five; char *six, seven, eight, nine, ten, eleven, twelve; four = myfunction(); Do not declare functions inside other functions; ANSI C says that such declarations have file scope regardless of the nesting of the declara- tion. Hiding file declarations in what appears to be a local scope is undesirable and will elicit complaints from a good compiler.