From owner-freebsd-questions@FreeBSD.ORG Wed Apr 16 20:41:35 2014 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E50C6623 for ; Wed, 16 Apr 2014 20:41:35 +0000 (UTC) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E79E1DF1 for ; Wed, 16 Apr 2014 20:41:34 +0000 (UTC) Received: from r56.edvax.de (port-92-195-108-40.dynamic.qsc.de [92.195.108.40]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx01.qsc.de (Postfix) with ESMTPS id 247D83CE69; Wed, 16 Apr 2014 22:41:31 +0200 (CEST) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id s3GKeOCg003617; Wed, 16 Apr 2014 22:40:24 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Wed, 16 Apr 2014 22:40:24 +0200 From: Polytropon To: Jorge Luis Carvalho Santos Subject: Re: The source code of *BSD contains the comment =?UTF-8?B?4oCY?= =?UTF-8?B?RG9lcw==?= this belong =?UTF-8?B?aGVyZT/igJk=?= Message-Id: <20140416224024.cd0c072f.freebsd@edvax.de> In-Reply-To: References: <20140416154900.1b4d2ee9.freebsd@edvax.de> Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Apr 2014 20:41:36 -0000 On Wed, 16 Apr 2014 17:14:22 +0300, Jorge Luis Carvalho Santos wrote: > Polytropon, was placed Examples of the presence of comment > ‘Does this belong here?’ in source code of FreeBSD and OpenBSD > second users in Gentoo Forums. Erm, why do you place those in Gentoo Forums? Those are usually Linux-related, while FreeBSD (and the other BSDs) are not Linux? Before I reply to your quotes, allow me to ask you: Are you fully sure you _understand_ what comments are? Just in case this isn't fully clear (which is quite possible to someone who is not a programmer): Comments mainly serve _two_ purposes: 1st: Comments are written by humans intended for humans. Those humans usually are developers, programmers, code auditors or reviewers. 2nd: Comments explain code, especially when the code is not very obvious in what it does. Things like int i = 1; /* associate the number 1 to the variable 'i' */ are not helpful, as you will agree, but more complex things tend to be more readable if some comment is attached. Regarding the "does this belong here" question: Sometimes a programmer gets something working, but isn't fully sure if it conforms to established guidelines, "good style", external requirements, or he actually doubts that this code belongs to where he wrote it. In this case, communication starts, and _one_ of those places is the code file itself (see 1st reason). Those comments usually indicate "there's still work to be done, even though it already works". In many cases, a prefix like "TODO", "FIXME" or "XXX" is being used to draw other programmers' attention to that piece of code. Finally, this kind of comments is being removed. But as projects like FreeBSD and especially Linux are in a flow of constant development and improvement, it's possible that they will be kept for some times. This is simply because (a) comments don't hurt anyone, and (b) those who read them _know_ how to treat them. The comment examples you refered to are a good illustration of this concept, and as shown, they are also present in FreeBSD: > (from Slashdot): > haeleth@guthlac$ uname -srpi > FreeBSD 5.4-RELEASE i386 GENERIC > haeleth@guthlac$ pwd > /usr/src/sys > haeleth@guthlac$ find . -name *.c -or -name *.h -exec grep "belong here" {} \; > * XXX doesn't really belong here I guess... > * This doesn't really belong here, but I can't think of a better > * XXX doesn't really belong here I guess... > * XXX FIXME: probably does not belong here > * XXX FIXME: probably does not belong here > /* XXX FIXME this does not belong here */ > * XXX these don't really belong here; but for now they're Bow try to see the _meaning_ and _purpose_ of those comments within the relations depicted above. Regarding a different article, to illustrate the context explained above: > Citação:Various studies in the past have praised Linux for > its code quality compared with proprietary operating systems. That's interesting. How do you judge proprietary software, which is usually _closed_ source? Most aspects of proprietary source code cannot be judged by the majority of programmers, users or researchers, except maybe there's a massive security breach that leads to code being "released" to the public. Those who work in closed-source environments also often have to sign NDA-like agreements. Have a look at http://thedailywtf.com/ and see the "Code Snippets of the Day". Most idiotic code presented there probably originates from proprietary software. :-) > A study in December 2004 by code analysis company Coverity > found that the Linux kernel had only 985 bugs in 5.7 million > lines of code, significantly fewer than the 5000 bugs that > would be expected in a commercial program of similar size. First of all, 2004 is 10 years ago. Then how can you compare the number of found bugs to the number you _expect_ originating from a code that you can't see? In my opinion, this whole sentence is total nonsense and doesn't say anything. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...