From alex@kapran.bitmcnit.bryansk.su  Sat Jan 27 23:50:42 2001
Return-Path: <alex@kapran.bitmcnit.bryansk.su>
Received: from server.bitmcnit.bryansk.su (bitmcnit.bryansk.ru [195.239.213.9])
	by hub.freebsd.org (Postfix) with ESMTP id B8CB537B402
	for <FreeBSD-gnats-submit@freebsd.org>; 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 <alex@kapran.bitmcnit.bryansk.su>
Reply-To: alex@kapran.bitmcnit.bryansk.su
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: duplication in style.9
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         24690
>Category:       docs
>Synopsis:       duplication in style.9
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-doc
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 28 00:00:01 PST 2001
>Closed-Date:    Thu Feb 1 19:09:13 PST 2001
>Last-Modified:  Thu Feb 01 19:09:52 PST 2001
>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:
State-Changed-From-To: open->closed 
State-Changed-By: nik 
State-Changed-When: Thu Feb 1 19:09:13 PST 2001 
State-Changed-Why:  
Committed, thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=24690 
>Unformatted:
