HDTenEightyP/NetNews huggingface dataset:
From: hartman@ulogic.UUCP (Richard M. Hartman)
Newsgroups: comp.programming,comp.lang.c
Subject: Re: NO NUMBERS! (or even SHORT INTS!)
Date: 8 Oct 92 17:40:38 GMT
Followup-To: comp.programming
Organization: negligable

In article <1992Oct7.123207.4987@monu6.cc.monash.edu.au> bena@yoyo.cc.monash.edu.au (Ben Aveling) writes:
>Geoff Kuenning (geoff@ITcorp.com) wrote:
>: In article <tholle16.717655308@ursa> tholle16@ursa.calvin.edu (Tim Hollebeek) writes:
>: 
>: (3) It is *always* poor practice to name a constant after its value.
>: There is nothing stupider than:
>: 
>: 	#define ONE 1
>: 	...
>: 	x += ONE;
>: 
>: Name constants after their purpose.
>
>I've heard of something stupider.  Started off much as above, 
>#define FOUR 4
>
>After some time, a major change was made, line had to change to
>#define FOUR 5
>

There was a really old bug I heard of once.  FORTRAN compiler
kept literal values as if they were variables (who knows why,
perhaps it had to do w/ the machine architecture....) so when 
a typo occurred, instead of:
	i3 = i1+1
they had:
	3 = i1+1

and from then on the numeric constant '3' in the program was
interpreted as whatever the value of "i1+1" was at the time
(i.e. if i1 had been 5, i1+1 would have been 6 and from then
on,
	i2 = 1+3
would set i7 to the value of 9!!!)

Aren't you glad that compilers today are perfect?		;)

		-Richard Hartman
		hartman@ulogic.COM

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Moderation in all things....		         ....especially moderation.
From: ath@linkoping.trab.se (Anders Thulin)
Newsgroups: comp.programming
Subject: Re: Pi (was Re: NO NUMBERS! (or even SHORT INTS!))
Date: 9 Oct 92 10:53:21 GMT
Organization: Telia Research AB, Teknikringen 2B, S-583 30 Linkoping, Sweden

In article <389@ulogic.UUCP> hartman@ulogic.UUCP (Richard M. Hartman) writes:
>
>Just off the top of my head:
>
>#define PI ((double) 3.1415926535897932384626)
>

Or include <math.h> if you have it, and use M_PI instead.

-- 
Anders Thulin       ath@linkoping.trab.se 	013-23 55 32
Telia Research AB, Teknikringen 2B, S-583 30 Linkoping, Sweden
Newsgroups: comp.programming
From: usenet@nntpd.lkg.dec.com (USENET News System)
Subject: Re: Calculating a CRC of other CRCs
Organization: Digital Equipment Corp.
Date: Wed, 7 Oct 1992 05:16:57 GMT

In article <1992Oct5.103012.9011@iccgcc.decnet.ab.com> schmidtg@iccgcc.decnet.ab.com writes:
>a direct byte by byte comparison would be too time consuming.  I only need
>to know whether the two programs are identical or they are different -- I
>will not be generating difference listings.  I would like to use a CRC
>computed on the entire program as a means of comparison.
>
>In addition, the program is organized as "chunks" and a chunk may be
>independently edited.  However, when the chunk is edited, I would like to
>avoid having to recalculate the CRC for the entire program.  I would like to
>somehow "incrementally" update the CRC based on a small change.

Why use CRCs?

In the first place, you are looking for an APPROXIMATE test.  If the two
checksums differ, then you KNOW the sources differ.  If the two checksums
match, then you can only guess, the sources PROBABLY match.  But if you
want to avoid screwing one out of ever 65536 customers (or 2 to whatever
size checksum you use) then, when the checksums PROBABLY match, you'll
want to fall back to a more careful check.

Now, if having the two sources match is the most likely possibility, then
you're out of luck with this approach.  You'll have to fall back on something
like, which machine name and timestamp applied to the last edit in each
source, and warn your customers not to play games with those (unless THEY
want to screw themselves).

Anyway, CRCs are a special kind of checksum.  In transmission over some
kinds of channels, burst errors are common.  CRCs are usually tuned to
catch 100% of all burst errors up to a certain number of consecutive bytes.
They'll still only catch roughly the average proportion of burst errors
past that limit, as any other checksumming method would (for the same size
of checksum).

So if you have a reliable channel and you only want to test whether two
sources PROBABLY match, you could just do + (arithmetic add) or XOR or
something else on all the bytes of each source.  And when a small chunk
is edited, subtract the checksum of the old portion (or XOR it back out)
and add the checksum of the new portion (or XOR it in) and it's a piece
of cake.

Of course, this technique is about 50 years old, which means we can assume
someone's going to get a patent on it soon  :-(
--
Norman Diamond       diamond@jit081.enet.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.
"Yeah -- bad wiring.  That was probably it.  Very bad."
From: ajayshah@almaak.usc.edu (Ajay Shah)
Newsgroups: comp.programming
Subject: Re: A good 'diskette-filling' algorithm?
Date: 12 Oct 1992 17:39:42 -0700
Organization: University of Southern California, Los Angeles, CA
NNTP-Posting-Host: almaak.usc.edu

vaarisko@tnclus.tele.nokia.fi writes:

>Does anyone know a good algorithm for a 'diskette-filling' program?

I wrote a program pack.awk which was posted on comp.sources.misc

        -ans.
-- 
Ajay Shah, (213)749-8133, ajayshah@usc.edu
Newsgroups: comp.programming
From: faraghec@cognos.com (Chad Faragher)
Subject: Re: Pi (was Re: NO NUMBERS! (or even SHORT INTS!))
Organization: Cognos Incorporated, Ottawa CANADA
Date: Fri, 9 Oct 1992 12:55:20 GMT

In article <389@ulogic.UUCP> hartman@ulogic.UUCP (Richard M. Hartman) writes:
>#define PI ((double) 3.1415926535897932384626)
>
>Truncate as appropriate for your compiler.
>
>If you need more digits, you're on your own.
>
>I am not 100% certain about that final '6'.

In case it is important, the last six are correct.

PI = 3.1415926535 8979323846 2643383279 5028841971 6939937510 5820974944
       5923078164 0628620899 8628034825 3421170679

(From the top of my head.)  the 101st digit is an 8, round accordingly.
Newsgroups: comp.programming,comp.lang.c,comp.lang.pascal,comp.lang.objective-c
From: pdh@netcom.com (Phil Howard )
Subject: Re: NO NUMBERS! (or even SHORT INTS!)
Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
Date: Fri, 9 Oct 1992 06:34:00 GMT

mroussel@alchemy.chem.utoronto.ca (Marc Roussel) writes:

>     Hmmph.  I like to compute my own constants as much as possible, but
>this sort of thing is dangerous.  At the very least you would have to
>make sure you do this right (using some sort of series summation method
>and doing careful error control, presumably in some exact arithmetic
>system).  I would not want to rely on the value of PI generated by some
>application of inverse trig functions nor would I want to sum a series
>for PI in floating point arithmetic.  On most machines, this would be
>OK, but it's not too hard to find hardware/compiler combinations that
>are ridiculously poor at evaluating some functions for extreme values
>of the arguments.  It is probably best in all but the most unusual of
>cases to simply get a well-authenticated value of PI valid to some large
>number of digits, type it in once, verify it many times (from
>different sources) and use that consistently thereafter.

Using a large number system I took a long decimal value of PI (the system
worked directly in decimal) and multipled it by 2 several times to get the
value of PI multiplied by 2 raised to some high power.  I saved the whole
part of this number.  When I need PI, I express it as that whole number
(in an appropriate floating point form) divided by that same power of 2.
This usually causes the least damage to the precision of the number.
It often works more accurately than some decimal conversions of fractional
quantities.
-- 
/***********************************************************************\
| Phil Howard  ---  KA9WGN  ---  pdh@netcom.com   |   "The problem with |
| depending on government is that you cannot depend on it" - Tony Brown |
\***********************************************************************/
Newsgroups: comp.programming
From: markg@pdx820 (Mark Gonzales)
Subject: Re: Pseudo-Random number generators
Summary: correction
Organization: Intel Corp., Hillsboro, Oregon
Date: Fri, 16 Oct 1992 22:46:31 GMT

In article <VLADIMIR.92Oct15194220@cocteau.Eng.Sun.COM> vladimir@Eng.Sun.COM (Vladimir Ivanovic) writes:
>[...]
>Here are the two proposed random number generators.  Even though I have proof
>read them twice, I made no guarantees whatsoever about the correctness or the
>usability of the code below.  
>
>Here is the Minimal Standard proposed by Park and Miller:
>
>	function Random : real;
>	{ Initialize seed with 1..2147483646 }
>	{ maxint must be greater than or equal to 2**31 - 1 }
>	const
>	  a = 16807;
>	  m = 2147483647;
>	  q = 12773;       { m div a }
              ^^^^^^
          q = 127773;      { according to my references & my calculator}

An easy typo to make. (The rest of the numbers agree with my version.)

Incidentally, how long would it take a user to realize that the typo was
there?  I know it took a team of 3 people on a project not a million
miles from this workstation over a month to notice that their software
vendor had supplied a random number generator with a period of only 8192
numbers. None of the vendor's other customers had noticed this when we
pointed it out, even though the product has been on the market for over
a year.

>	  r = 2836;	   { m mod a }
>	var
>	  lo, hi, test : integer;
>	begin
>	  hi := seed div q;
>	  lo := seed mod q;
>	  test := a * lo - r * hi;
>	  if test > 0 then
>	     seed := test
>	  else
>	     seed := test + m;
>	 Random := seed / m
>       end;
>

Mark
not speaking for anyone, use at your own risk, no warrenty expressed or
implied, void where prohibited, subject to prior sale, vin number 102-2222
Newsgroups: comp.programming
From: sl313028@silver.ucs.indiana.edu (Jon Marcus Madison)
Subject: BOOK ON C (Was: FAQ...& C Programming)
Keywords: printf("hello, world\n");
Organization: Indiana University
Distribution: comp.programming
Date: Thu, 15 Oct 1992 16:50:24 GMT

The best book i've purchased is the Schaum's Outline book, called
_Programming_ _in_ _C_.  it starts out with a program, and then explains
it.  maybe im not the person to answer, since i used Pascal as a first
Language (HIGHLY reccommended, i wrote an english paper explaining my
case), but it proved VERY helpful, up to about when you start to learn
about linked-lists & stuff (which unfortunately is where my C class
*started* !)

oh, here's a question...
someone mentioned comp.language.c... is this a newsgroup?? if so, we
don't get it here, and I'm MAD!!!

can someone direct me to a C channel somewhere?

thanx...
-jon madison
sl313028@silver.ucs.indiana.edu
jmmadiso@indyvax.iupui.edu
(Forever Loving Jah)




Newsgroups: comp.programming
From: dnl@convex.is.macsch.com (David Lombard)
Subject: Re: NO NUMBERS! (or even SHORT INTS!)
Organization: MacNeal-Schwendler Corp.
Date: Tue, 13 Oct 92 20:28:55 GMT

>There was a really old bug I heard of once.  FORTRAN compiler
>kept literal values as if they were variables (who knows why,
>perhaps it had to do w/ the machine architecture....) so when 
>a typo occurred, instead of:
>	i3 = i1+1
>they had:
>	3 = i1+1
>
>and from then on the numeric constant '3' in the program was
>interpreted as whatever the value of "i1+1" was at the time
>(i.e. if i1 had been 5, i1+1 would have been 6 and from then
>on,
>	i2 = 1+3
>would set i7 to the value of 9!!!)
>
>Aren't you glad that compilers today are perfect?		;)


This is possible in any language on any machine which:

	Can pass constants by address.
	Does not have write protected memory segments.

Most *older* Fortran compilers/platforms were simply a more willing partner.

Regards,
DNL
******************************************************************************
*               MY COMMENTS == MY OPINIONS != ANYBODY ELSES                  *
******************************************************************************
* David N. Lombard                               The MacNeal-Schwendler Corp *
* dnl@macsch.com                                 815 Colorado Blvd           *
* (213) 259-4911 FAX: (213) 259-3838             Los Angeles, CA  90041      *
******************************************************************************
From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe)
Newsgroups: comp.programming
Subject: Re: reference counting garbage collection
Date: 7 Oct 92 04:55:54 GMT
Organization: Comp Sci, RMIT, Melbourne, Australia

In article <LOWRY.92Oct4170206@rotor.watson.ibm.com>,
 lowry@watson.ibm.com (Andy Lowry) writes:
> reference counting does have its place.

One example:  the UNIX file system.  Hard links are references, and a file
survives just as long as (its reference count is non-zero or it is open in
a running process).  There are cycles (due to ".."), but that's one of the
reasons why rmdir used to be a separate program.
Newsgroups: comp.programming
From: sethb@fid.morgan.com (Seth Breidbart)
Subject: Re: A good 'diskette-filling' algorithm?
Organization: Morgan Stanley & Co., New York, NY
Date: Mon, 12 Oct 1992 21:34:58 GMT

In article <1992Oct12.133917.1@tnclus.tele.nokia.fi>
vaarisko@tnclus.tele.nokia.fi writes:
>
>Does anyone know a good algorithm for a 'diskette-filling' program?
>The algorithm should find a subset of a set of numbers (=file sizes)
>the sum of which is closest, but not bigger, than a given number (=disk
>space left) ie. kind of a 'best-fit' algorithm..

The problem is NP-complete.

>I intend to put the algorithm into practice using 4dos batch language, so if
>it tends to be *VERY* slow, maybe a 'nearly best-fit'-algorithm would do.

First-fit decreasing is pretty good.

Seth		sethb@fid.morgan.com
Newsgroups: comp.programming
From: hansm@cs.kun.nl (Hans Mulder)
Subject: Re: NO NUMBERS! (or even SHORT INTS!)
Organization: University of Nijmegen, The Netherlands
Date: Fri, 9 Oct 1992 22:29:46 GMT

In <392@ulogic.UUCP> hartman@ulogic.UUCP (Richard M. Hartman) writes:
>There was a really old bug I heard of once.  FORTRAN compiler
>kept literal values as if they were variables (who knows why,
>perhaps it had to do w/ the machine architecture....) so when 
>a typo occurred, instead of:
>	i3 = i1+1
>they had:
>	3 = i1+1

That's a syntax error.

>and from then on the numeric constant '3' in the program was
>interpreted as whatever the value of "i1+1" was at the time.

>Aren't you glad that compilers today are perfect?		;)

Are you sure they are?  Watch closely:

Script started on Fri Oct  9 23:22:39 1992
<1>% cat foo.f
        program main
        call assign(4,5)
        call out(5)
        end

        subroutine out(five)
        integer five
        write (6,10) five
10      format(x, 4h2+3=, i1)
        return
        end

        subroutine assign(from,to)
        integer from, to
        to=from
        return
        end
<2>% f77 foo.f
foo.f:
 MAIN main:
        out:
        assign:
<3>% a.out
 2+3=4
<4>% exit
exit

script done on Fri Oct  9 23:23:08 1992

See, it still works that way.

[ Yes, I know this program violates some obscure clause
in the ANSI standard. ]

--
Hans Mulder		hansm@cs.kun.nl
Newsgroups: comp.programming
From: mccall@mksol.dseg.ti.com (fred j mccall 575-3539)
Subject: Re: C programing
Organization: Texas Instruments Inc
Date: Tue, 13 Oct 1992 22:04:06 GMT

In <1992Oct8.152326.10066@hubcap.clemson.edu> mjs@hubcap.clemson.edu (M. J. Saltzman) writes:

>In article <1992Oct7.204027.5598@netcom.com> pdh@netcom.com (Phil Howard ) writes:
>>ratner@ficus.cs.ucla.edu (David Ratner) writes:
>>
>>>ai686@cleveland.Freenet.Edu (Ishaq Syed) writes:
>>>
>>>>I am highschool student..and I would like to request a book that
>>>>would teach me C in a si,mple way.  All the books I have incountered
>                         ^^^^^^^^^^^
>>>>so far have been very complcateed.  I would like a name of a book that
>>>>is good for self learning people.  The place I can buy the book would also 
>>>>be nice.  Thank you very much.
>>>
>>>Book:  K&R.  (Kernighan and Ritchie - "The C Programming Language").
>>>Place: bookstore.
>>
>>Another possibility is Harbison and Steele - "C: A Reference Manual".
>>Place: same as above

These are the two best books to have, but neither is a 'simple' intro
to C and programming.  I learned my C from these two, plus the net
(listen for a year or two and you'd be surprised at what you can pick
up), but that was after learning half a dozen other languages first
and writing a fair amount of code of various types in various
languages. 

>IMHO, neither of these books fill Ishaq's needs.  Yes, K&R is generally
>well-written (and I learned C from K&R1), but it's not the book for
>novice programmers.  In the preface to K&R1, they write: "This book is
>not an introductory programming manual."  And I wholeheartedly agree.

>H&S is exactly what the title says it is: a *reference manual*.  Using it
>well requires that you already be a knowledgeable C programmer.  Using
>it to learn C is hopeless.

>Now, having said that, I don't really have a recommendation for an
>introductory text in C, since I didn't learn it at that level, and I
>don't have any books like that on my bookshelf.  However, I have heard
>fairly high net.praise for _C:_A_Software_Engineering_Approach_, and
>for Kelley & Pohl's _A_Book_on_C_.

>I'm not even sure it wouldn't be a better idea to learn a less
>dangerous language (like Pascal) first.  (C is sort of the straight razor
>of classical programming languages--it gives a close shave, but you can 
>cut yourself really easily!)

Exactly right.  The problem with finding a 'simple' book on C is that
it will probably teach you just enough to handily blow your foot right
off.  I still recommend Pascal as a first language, keeping in mind
that most of the world isn't as kind to you as a Pascal compiler is
going to be.  Then, after you understand about program development,
worry about learning something like C.

-- 
"Insisting on perfect safety is for people who don't have the balls to live
 in the real world."   -- Mary Shafer, NASA Ames Dryden
------------------------------------------------------------------------------
Fred.McCall@dseg.ti.com - I don't speak for others and they don't speak for me.
Newsgroups: comp.programming
From: bdowning@mary.fordham.edu (Brian Downing)
Subject: Anybody got the tic-tac-toe algorithm?
Organization: Fordham University
News-Software: VAX/VMS VNEWS 1.41    
Date: Sat, 10 Oct 1992 10:23:00 GMT
X-Posted-From: mary.fordham.edu
NNTP-Posting-Host: sol.ctr.columbia.edu

  As the subject says, I'm looking for a solutions to the tic-tac-toe
game. Preferably in C as I've already got one in either snobol or prolog
(I don't remember which it is) and also one in DCL (yech!).

  Many thanks, 
  Brian

brian downing bdowning@mary.fordham.edu fordham university new york city
Yow!  Maybe I should have asked for my Neutron Bomb in PAISLEY--
Newsgroups: comp.programming
From: pdh@netcom.com (Phil Howard )
Subject: Re: C programing
Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
Date: Wed, 7 Oct 1992 20:40:27 GMT

ratner@ficus.cs.ucla.edu (David Ratner) writes:

>ai686@cleveland.Freenet.Edu (Ishaq Syed) writes:
>
>>I am highschool student..and I would like to request a book that
>>would teach me C in a si,mple way.  All the books I have incountered
>>so far have been very complcateed.  I would like a name of a book that
>>is good for self learning people.  The place I can buy the book would also 
>>be nice.  Thank you very much.
>
>Book:  K&R.  (Kernighan and Ritchie - "The C Programming Language").
>Place: bookstore.

Another possibility is Harbison and Steele - "C: A Reference Manual".
Place: same as above
-- 
/***********************************************************************\
| Phil Howard  ---  KA9WGN  ---  pdh@netcom.com   |   "The problem with |
| depending on government is that you cannot depend on it" - Tony Brown |
\***********************************************************************/
Newsgroups: comp.programming
From: dak@tabaqui.informatik.rwth-aachen.de (David Kastrup)
Subject: Re: reference counting garbage collection
Organization: Rechnerbetrieb Informatik  /  RWTH Aachen
Date:  8 Oct 92 19:31:44 GMT

nickel@cs.tu-berlin.de (Juergen Nickelsen) writes:


>How does reference counting garbage collection (RCGC) deal with
>circular data structures? 

ASCII simple question, get a simple ANSI.
It simply does not. A structure which gets around to reference itself
is considered a complete circle, a perfection, a god. And gods are
immortal and clog up your memory.
From: Pierre.Couldwin@Laurin-H.nsn.ni.schule.de (Pierre Couldwin)
Organization: Laurin's, Hannover, Niedersaechsisches Schulnetz
Sender: GateServer@nsn.ni.schule.de
Newsgroups: comp.programming
Subject: Mailer-programming
Date: 04 Oct 92  19:51:00 MET

Hi Leuts !

Ich habe da ein kleines Problem.
Und zwar habe ich vor, ber ein externes Programm auf einen CONNECT zu 
warten,
diesen dann genaustens zu erkennen, um dann mit passendem ErrorLevel ber 
eine
Batchdatei diesen dann weiter zu verarbeiten.
Wozu ?
Naja, ich mchte damit UNMGLICHE, zwar vom Modem zu erkennende, aber vom
internen Mailer von Remote Access nicht zu erkenndenen CONNECT korrekt zu
bergeben. Z.B. bei 16800 gibt's bei RA Probs. Solange es bei ZyXEL die 
19200
noch nicht gibt, ist das nicht allzu problematisch, da man in diesem Falle 
mit
19200 weiter arbeiten kann. Spter ist das dann nun nicht mehr mglich.
Auerdem soll dadurch geregelt werden, da ich ein FAX-extern laden kann. 
D.h.
wenn das Proggi ein FAX erkennt, liefert es den passenden ErrorLevel zurck,
und ich starte dann das FAX-Receive-PRG.
"Ja", werden einige sagen: "dafr gibt es aber bereits solche Mailer wie
FrontDoor und d'Bridge und so weiter." Nur diese Programme bieten z.T. 
soviel,
da es schon zuviel ist. Auerdem, um sie vernnftig nutzen zu knnen, 
braucht
man die registrierte, die kostet Geld. Und das schlimmste ist, die nehmen
tierisch viel Speicher weg. Sowohl auf Platte, als auch im Speicher.
Ich habe schon an meinen Mailer rumgebastelt, aber irgendwie bin ich wohl zu
bld. Ich hab's mit Hardware-programming versucht, ich hab's ber den Fossil
versucht. Bisher ist da nix vernnftiges rausgekommen. Wobei ich dazu sagen
mu, bisher habe ich auch noch nicht den richtigen Plan gehabt.
Kann mir da vielleicht jemand weiterhelfen ?  Das wre nmlich echt nett, 
wenn
ich demnchst die incoming-FAXs und die "normalen" CONNECTS von einander
trennen knnte, auerdem noch die richtigen Baudraten (ENDLICH) habe.

Also, ich hre von Euch

Bye, Pierre...

PS.: Tschuldigt diesen Zeilenumbruch...  
 

 * Origin: LAURIN'S BBS @laurin-h.nsn.ni.schule.de (49:300/0)
Newsgroups: comp.programming,comp.unix.programmer
From: jk@teal.csn.org (John Kranz)
Subject: LZ compression copyright?
Organization: Colorado SuperNet, Inc.
Distribution: usa
Date: Fri, 9 Oct 1992 17:37:24 GMT

Anybody:

We have developed a software product which utilizes LZ compression.

Does anybody know:

        -- who owns the copyright?
        -- the legality of using it inside a distributed for profit
           software package?
        -- if it is legal to check for its presence on the system
           and perform LZ compression if and only if it's there?

Any guidance would be appreciated. Please e-mail to:

        jk@spectra.wali.com

Thank-you,
jk