🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.micro.mac
Article #1575

Re: Harmonic Series Benchmark

#1575
From: guido
Date: Thu, 30 May 1985 20:41
84 lines
3974 bytes
I have unpacked the "Harmonics" benchmark program from the net, and
was rather upset about what was left of my favourite language, "C".

(Readers not prepared for flames, please skip to "Comments", below.)

----------
> #Options D=300

What's this?  can't we just pass the options to the C compiler any more?

----------
> // To make it fit 128K Mac

Is this a new form of comment?  Even if the compiler allows it, don't
you ever dare use it.  Even if you can't restrain yourself totally,
DON'T USE IT IN PROGRAMS YOU ARE POSTING TO THE NET!
(Hint, hint, as Chuqui would add.)

----------
> extended seconds;

Huh?  Is this a recent extension to ANSI C that I have missed?

----------
> int fd = open(outfile, 1);
> fprintf(fd, "Calculating the sum of 10,000 terms of the harmonic series\n");

Er, umm, I thought that files to be used with fprintf c.s. should be opened
with *fopen*, not with *open*.  On some systems (including that obscure
system whose name starts with U, ends with an x and has nothing but footnotes
in between) this makes a lot of differences, ya know.

----------
And now for the worst offense to C's syntax:

> printf("Calculating the sum of 10,000 terms of the harmonic series\n");
> /* Lots of printf's */
> register int i;
> register float j = 0;

I am sure that when I last looked, declarations should strictly *precede*
statements.

----------
>     printf("\nThis is a Macintosh with Consulair Mac C 2.0,\n");

WRONG.  This Macintosh (i.e., mine) is running SUMacC.
----------
(End flame)
==========

Comments

I won't comment on programming style, but I think that a program that is
meant as a benchmark could at least have the decency to use only portable
features of a language.  Where this is not possible (e.g., when the timing
difference for using 'extended' numbers is exercised), #ifdefs should
enclose the non-portable sections, and appropriate warnings made in comments.

Alternatively, it is possible that this was one of the first C programs
ever written by its author.  In this case, considering the burden already
placed on the net by inappropriate or duplicate postings, it would have
been better not to post it at all.  Consider this article as a short
lesson in portability.

Admittedly, it is quite possible that the manufacturers of Consulair C
have done their best to hide the fact that there are other versions of
C than theirs, and not provided any clues to the differences.  The fact
that they added #Options, one-line comments and the 'extended' data type
makes one expect the worst.  One suspects that they have never been exposed
to a real C compiler (I mean one running under U**x).  How come they're
such a big success?

BTW, SUMacC floating point (at least what you get when you use 'double' or
'float' variables) is not SANE, and it has some peculiarities, but the
timing was about 22 seconds, independent of whether float or double was
used.  The answer seemed right, at least for 'double'.  (Just to prove
that I *did* manage to correct all the bugs mentioned above.)

	Guido van Rossum, CWI, Amsterdam
	guido@mcvax.UUCP

(Remember, there is more to the Mac than raw computing power.)
Technical Details
Message-ID: <6437@boring.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!linus!philabs!cmcl2!seismo!mcvax!boring!guido
References: <1363@amd.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83 (MC840302); site boring.UUCP
Path: arc1-ca.pugleaf.net!utzoo!linus!philabs!cmcl2!seismo!mcvax!boring!guido
From: guido@boring.UUCP
Newsgroups: net.micro.mac
Subject: Re: Harmonic Series Benchmark
Message-ID: <6437@boring.UUCP>
Date: Thu, 30-May-85 16:41:00 EDT
Article-I.D.: boring.6437
Posted: Thu May 30 16:41:00 1985
Date-Received: Sat, 1-Jun-85 13:39:53 EDT
References: <1363@amd.UUCP>
Reply-To: guido@boring.UUCP (Guido van Rossum)
Organization: "Stamp Out BASIC" Committee, CWI, Amsterdam
Lines: 83
Keywords: Consulair, SUMacC, C, portability
Summary: flame about Consulair C peculiarities in posted program
Apparently-To: rnews@mcvax.LOCAL