By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,378 Members | 3,020 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,378 IT Pros & Developers. It's quick & easy.

Code quality and examples from open source C code

P: n/a
A quick note to inform my fellow C programmers that my new book "Code
Quality: The Open Source Perspective" (Addison-Wesley, 2006) has just
been published. All 623 examples I use in the book are drawn from
real-world open source code; most use C, as the lowest common
denominator. For more details you can visit the book's web site at
<http://www.spinellis.gr/codequality?clc>.

--
Diomidis Spinellis Associate Professor
Department of Management Science and Technology (DMST)
Athens University of Economics and Business (AUEB)
http://www.dmst.aueb.gr/dds/ mailto:dd*@aueb.gr
Apr 11 '06 #1
Share this Question
Share on Google+
10 Replies


P: n/a
On Tue, 11 Apr 2006 17:28:36 +0300, Diomidis Spinellis <dd*@aueb.gr>
wrote:
A quick note to inform my fellow C programmers that my new book "Code


So, your first-ever posting to your "fellow C programmers" in this
group is an advertisement. Will it be your last? Will you even check
back for responses?

--
Al Balmer
Sun City, AZ
Apr 11 '06 #2

P: n/a
Al Balmer wrote:
On Tue, 11 Apr 2006 17:28:36 +0300, Diomidis Spinellis <dd*@aueb.gr>
wrote:
A quick note to inform my fellow C programmers that my new book "Code


So, your first-ever posting to your "fellow C programmers" in this
group is an advertisement. Will it be your last? Will you even check
back for responses?


I first posted in comp.lang.c in 1990:

* Re: popen() (5 Mar 90 09:35:40 GMT)
* Re: isalpha in ctype.h (Tue, 26 Mar 1991 10:59:25 GMT)

(you can find the articles here
http://www.spinellis.gr/news/comp_lang_c.html), and, yes, I'm back to
check for responses.

Diomidis
Apr 11 '06 #3

P: n/a
On Tue, 11 Apr 2006 23:24:11 +0300, Diomidis Spinellis <dd*@aueb.gr>
wrote:
Al Balmer wrote:
On Tue, 11 Apr 2006 17:28:36 +0300, Diomidis Spinellis <dd*@aueb.gr>
wrote:
A quick note to inform my fellow C programmers that my new book "Code
So, your first-ever posting to your "fellow C programmers" in this
group is an advertisement. Will it be your last? Will you even check
back for responses?


I first posted in comp.lang.c in 1990:

* Re: popen() (5 Mar 90 09:35:40 GMT)
* Re: isalpha in ctype.h (Tue, 26 Mar 1991 10:59:25 GMT)

First and last, eh? Pre-dejanews, apparently, or at least pre-Google
archives.
(you can find the articles here
http://www.spinellis.gr/news/comp_lang_c.html), and, yes, I'm back to
check for responses.


OK, here's a response: Advertisements are not welcomed in comp.lang.c,
even when peripherally related to the C language, the topic of this
group.

The accepted way to "advertise" in this (and many other technical
groups) is to participate and contribute, confining your advertising
to a short signature block.
Alan Balmer
Sun City, AZ

clc wiki: http://clc-wiki.net/wiki/Main_Page
Apr 11 '06 #4

P: n/a
Diomidis Spinellis wrote:

A quick note to inform my fellow C programmers that my new book
"Code Quality: The Open Source Perspective" (Addison-Wesley, 2006)
has just been published. All 623 examples I use in the book are
drawn from real-world open source code; most use C, as the lowest
common denominator. For more details you can visit the book's
web site at <http://www.spinellis.gr/codequality?clc>.


I may be all wet here, but while there is nothing wrong with your
charging for a book, I consider the material in a book based on
open source code should also be freely available. Is it? Open
source is not public domain, it remains copyright and carries some
form of license.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>
Apr 11 '06 #5

P: n/a
CBFalconer wrote:
Diomidis Spinellis wrote:
A quick note to inform my fellow C programmers that my new book
"Code Quality: The Open Source Perspective" (Addison-Wesley, 2006)
has just been published. All 623 examples I use in the book are
drawn from real-world open source code; most use C, as the lowest
common denominator. For more details you can visit the book's
web site at <http://www.spinellis.gr/codequality?clc>.


I may be all wet here, but while there is nothing wrong with your
charging for a book, I consider the material in a book based on
open source code should also be freely available.


You could make such a case for GPL-licensed code, although even in that
case one would probably argue that the excerpting of code for criticism
and commenting falls under the copyright's fair use doctrine
<http://en.wikipedia.org/wiki/Fair_use>. Nevertheless, to be extra
safe, all the source code used in both "Code Reading" and "Code Quality"
is licensed under the more liberal BSD and similar licenses. For "Code
Reading", which included the source code on a CD-ROM, the book had all
the relevant licenses printed as an appendix (this is a requirement of
many licenses).

This discussion has nothing to do with comp.lang.c, and I feel guilty
for (unwittingly) inciting it. If I didn't answer your question, maybe
we should discuss it further by email.

Diomidis
Apr 12 '06 #6

P: n/a
Diomidis Spinellis said:
A quick note to inform my fellow C programmers that my new book "Code
Quality: The Open Source Perspective" (Addison-Wesley, 2006) has just
been published.


Thanks, Diomidis.

It's a bit of a shame that you've met with a rather frosty response
from Al and Chuck. In their defence, we do get a lot of junk posted
in this group.

I am grateful to you for taking the trouble to write a book which,
to judge by its title and author, will be well worth adding to
one's collection.

And just to trash your reputation completely amongst those who don't
know, I cannot resist posting a typical Diomidis Spinellis program
which, I think, perfectly demonstrates the importance of ensuring
the quality of Open Source code. ;-)
(Word wrap turned off for this bit)
#define O(b,f,u,s,c,a)b(){int o=f();switch(*p++){X u:_ o s b();X c:_ o a b();default:p--;_ o;}}
#define t(e,d,_,C)X e:f=fopen(B+d,_);C;fclose(f)
#define U(y,z)while(p=Q(s,y))*p++=z,*p=' '
#define N for(i=0;i<11*R;i++)m[i]&&
#define I "%d %s\n",i,m[i]
#define X ;break;case
#define _ return
#define R 999
typedef char*A;int*C,E[R],L[R],M[R],P[R],l,i,j;char B[R],F[2];A m[12*R],malloc
(),p,q,x,y,z,s,d,f,fopen();A Q(s,o)A s,o;{for(x=s;*x;x++){for(y=x,z=o;*z&&*y==
*z;y++)z++;if(z>o&&!*z)_ x;}_ 0;}main(){m[11*R]="E";while(puts("Ok"),gets(B)
)switch(*B){X'R':C=E;l=1;for(i=0;i<R;P[i++]=0);while(l){while(!(s=m[l]))l++;if
(!Q(s,"\"")){U("<>",'#');U("<=",'$');U(">=",'!');} d=B;while(*F=*s){*s=='"'&&j
++;if(j&1||!Q(" \t",F))*d++=*s;s++;}*d--=j=0;if(B[1]!='=')switch(*B){X'E':l=-1
X'R':B[2]!='M'&&(l=*--C)X'I':B[1]=='N'?gets(p=B),P[*d]=S():(*(q=Q(B,"TH"))=0,p
=B+2,S()&&(p=q+4,l=S()-1))X'P':B[5]=='"'?*d=0,puts(B+6):(p=B+5,printf("%d\n",S
()))X'G':p=B+4,B[2]=='S'&&(*C++=l,p++),l=S()-1 X'F':*(q=Q(B,"TO"))=0;p=B+5;P[i
=B[3]]=S();p=q+2;M[i]=S();L[i]=l X'N':++P[*d]<=M[*d]&&(l=L[*d]);}else p=B+2,P[
*B]=S();l++;}X'L':N printf(I)X'N':N free(m[i]),m[i]=0 X'B':_ 0 t('S',5,"w",N
fprintf(f,I))t('O',4,"r",while(fgets(B,R,f))(*Q(B, "\n")=0,G()))X 0:default:G()
;}_ 0;}G(){l=atoi(B);m[l]&&free(m[l]);(p=Q(B," "))?strcpy(m[l]=malloc(strlen(p
)),p+1):(m[l]=0,0);}O(S,J,'=',==,'#',!=)O(J,K,'<',<,'>',>)O(K,V ,'$',<=,'!',>=)
O(V,W,'+',+,'-',-)O(W,Y,'*',*,'/',/)Y(){int o;_*p=='-'?p++,-Y():*p>='0'&&*p<=
'9'?strtol(p,&p,0):*p=='('?p++,o=S(),p++,o:P[*p++];}
If anyone yells at the use of gets(), I have two things to say to them:

(a) yeah, I know, it's bad and I wish he hadn't done it;
(b) forget it - put that complaint back on the shelf, and grok the code!
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
Apr 13 '06 #7

P: n/a
On Thu, 13 Apr 2006 00:26:32 +0000, Richard Heathfield
<in*****@invalid.invalid> wrote:
It's a bit of a shame that you've met with a rather frosty response
from Al and Chuck. In their defence, we do get a lot of junk posted
in this group.


You now compel me to defend my remarks by pointing out to their highly
desirable outcome: Dr. Spinellis has contributed at least one good
topical article to the group, and I hope there will be many more.

--
Al Balmer
Sun City, AZ
Apr 13 '06 #8

P: n/a
Richard Heathfield wrote:
Diomidis Spinellis said:
A quick note to inform my fellow C programmers that my new book
"Code Quality: The Open Source Perspective" (Addison-Wesley, 2006)
has just been published.


It's a bit of a shame that you've met with a rather frosty response
from Al and Chuck. In their defence, we do get a lot of junk posted
in this group.


Note that he replied to my concerns, with suitable assurances.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>
Apr 13 '06 #9

P: n/a
Richard Heathfield wrote:
Diomidis Spinellis said:
A quick note to inform my fellow C programmers that my new book "Code
Quality: The Open Source Perspective" (Addison-Wesley, 2006) has just
been published.


Thanks, Diomidis.

It's a bit of a shame that you've met with a rather frosty response
from Al and Chuck. In their defence, we do get a lot of junk posted
in this group.


No problem. These are the risks of posting to a public forum,
especially after a very long absence. From the replies to this message
it is obvious that Al and Chuck were trying to protect the newsgroup,
rather than attack me. Anyway, as you will have noticed, to redeem
myself I've started posting replies to some questions I feel I could
address. Hopefully this will restore the signal/noise ratio of my
contributions; however, I doubt I can address the damage done by your
posting of my obfuscated C code :-) In two cases I found that I could
provide answers to questions by posting excerpts from open-source code.
I'll continue to do that, until I start writing another book or
somebody here tells me to shut up.

Diomidis
Apr 13 '06 #10

P: n/a
Diomidis Spinellis said:
In two cases I found that I could
provide answers to questions by posting excerpts from open-source code.
I'll continue to do that, until I start writing another book or
somebody here tells me to shut up.


As someone famous once said:

Welcome to hell. Here's your handbasket. Say, can you
work 70 hours this week?

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Apr 13 '06 #11

This discussion thread is closed

Replies have been disabled for this discussion.