Date: Wed, 16 Apr 2014 22:40:24 +0200 From: Polytropon <freebsd@edvax.de> To: Jorge Luis Carvalho Santos <jorgeassembler1@outlook.com> Cc: freebsd-questions@freebsd.org 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: <COL127-W42F34B0D9CD4911C147835E8530@phx.gbl> References: <COL127-W50854C41C300BA3C07D981E8500@phx.gbl> <20140416154900.1b4d2ee9.freebsd@edvax.de> <COL127-W42F34B0D9CD4911C147835E8530@phx.gbl>
next in thread | previous in thread | raw e-mail | index | archive | help
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, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140416224024.cd0c072f.freebsd>