From owner-freebsd-doc Sun Jan 28 0: 0:24 2001 Delivered-To: freebsd-doc@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 546AD37B402 for ; Sun, 28 Jan 2001 00:00:02 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f0S802L62312; Sun, 28 Jan 2001 00:00:02 -0800 (PST) (envelope-from gnats) Received: from server.bitmcnit.bryansk.su (bitmcnit.bryansk.ru [195.239.213.9]) by hub.freebsd.org (Postfix) with ESMTP id B8CB537B402 for ; Sat, 27 Jan 2001 23:50:38 -0800 (PST) Received: (from uucp@localhost) by server.bitmcnit.bryansk.su (8.9.3/8.9.3) with UUCP id KAA18695 for FreeBSD-gnats-submit@freebsd.org; Sun, 28 Jan 2001 10:42:13 +0300 Received: (from alex@localhost) by kapran.bitmcnit.bryansk.su (8.11.1/8.11.1) id f0S7i9d02935; Sun, 28 Jan 2001 10:44:09 +0300 (MSK) (envelope-from alex) Message-Id: <200101280744.f0S7i9d02935@kapran.bitmcnit.bryansk.su> Date: Sun, 28 Jan 2001 10:44:09 +0300 (MSK) From: Alex Kapranoff Reply-To: alex@kapran.bitmcnit.bryansk.su To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: docs/24690: duplication in style.9 Sender: owner-freebsd-doc@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 24690 >Category: docs >Synopsis: duplication in style.9 >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-doc >State: open >Quarter: >Keywords: >Date-Required: >Class: doc-bug >Submitter-Id: current-users >Arrival-Date: Sun Jan 28 00:00:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: Alex Kapranoff >Release: FreeBSD 5.0-CURRENT i386 >Organization: >Environment: System: FreeBSD kapran.bitmcnit.bryansk.su 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Sat Jan 20 22:56:54 MSK 2001 root@kapran.bitmcnit.bryansk.su:/usr/obj/usr/src/sys/KAPRAN i386 >Description: 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. >How-To-Repeat: >Fix: *** /usr/src/share/man/man9/style.9 Fri Dec 29 19:07:03 2000 --- style.9 Sun Jan 28 10:37:12 2001 *************** *** 382,390 **** .Pp When declaring variables in functions declare them sorted by size, then in alphabetical order; multiple ones per line are okay. ! Declaring functions inside functions is not recommended, since their ! linkage scope is always global. If a line overflows reuse the type ! keyword. .Pp Be careful to not obfuscate the code by initializing variables in the declarations. Use this feature only thoughtfully. --- 382,388 ---- .Pp When declaring variables in functions declare them sorted by size, then in alphabetical order; multiple ones per line are okay. ! If a line overflows reuse the type keyword. .Pp Be careful to not obfuscate the code by initializing variables in the declarations. Use this feature only thoughtfully. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message