HDTenEightyP/NetNews huggingface dataset:
From: stephen@estragon.uchicago.edu (Stephen P Spackman)
Newsgroups: comp.programming
Subject: Re: functions & return values (was Re: Reinventing the wheel)
Date: 14 Apr 92 20:50:50 GMT
Article-I.D.: estragon.STEPHEN.92Apr14155058
Organization: University of Chicago CILS

In article <1992Apr14.154725.9397@cs.unca.edu> mcmahan@cs.unca.edu (Scott McMahan -- Genesis mailing list owner) writes:
|Functions that return more than one value!?
|
|That's terrible -- why would anyone *want* to do this? If it needs to
|return more than one value, it would be a lot easier to implement 
|and understand it if you just passed them in as parameters.

Excellent plan! In fact, we could outlaw return values altogether, and
only use procedures!!!!

But we still have ugly parentheses in calls. But we can solve that
too: use global variables instead!!!!

Oh boy oh boy.

If we try hard enough, maybe we can re-invent assembler.
----------------------------------------------------------------------
stephen p spackman         Center for Information and Language Studies
stephen@estragon.uchicago.edu                    University of Chicago
----------------------------------------------------------------------
Newsgroups: comp.programming
From: stephen@estragon.uchicago.edu (Stephen P Spackman)
Subject: Re: Names
Organization: University of Chicago CILS
	<kufk3iINNj9b@boogie.cs.utexas.edu>
	<1992Apr13.021853.4539@cujo.curtin.edu.au>
Date: Mon, 13 Apr 1992 05:42:20 GMT

In article <1992Apr13.021853.4539@cujo.curtin.edu.au> peter@cujo.curtin.edu.au (Peter N Lewis) writes:
|Type names start with a lowercase letter, and then each other word has an
|upper case letter (for ease of reading), with no underscores (thus types 
|should have at least two words):

|Procedures and Functions should have each word capitalized, with no 
|unbderscores.

|Variables and constants should be all in lowercase, with words seperated
|by underscores.

I'm very strongly opposed to this suggestion, since very often you
will want to select between options by passing in an option argument
to a function, and it is none of the user's business whether this
option flag is implemented as a "constant" or a "function" (quotes
because functions are typically constants anyway).

I'm also unhappy about a convention that *requires* all identifiers to
have multiple words; in particular, I rather like the ability to have
an arbitrary member of type Character be called character.

One other peculiar note on this topic: I find that it turns out to be
mnemonic (and help formatting) to choose related words so that they
have the same number of letters (!). So instead of allocate and free I
tend to use new and old.... I still haven't worked out WHY this seems
to make code clearer, but it does (seem to, I mean).
----------------------------------------------------------------------
stephen p spackman         Center for Information and Language Studies
stephen@estragon.uchicago.edu                    University of Chicago
----------------------------------------------------------------------
From: mcmahan@cs.unca.edu (Scott McMahan -- Genesis mailing list owner)
Newsgroups: comp.programming
Subject: Re: functions & return values (was Re: Reinventing the wheel)
Date: 14 Apr 92 15:47:25 GMT
Organization: University of North Carolina at Asheville

Functions that return more than one value!?

That's terrible -- why would anyone *want* to do this? If it needs to
return more than one value, it would be a lot easier to implement 
and understand it if you just passed them in as parameters.

a,b,c,d,e = foobar(x,y,)

(nevermind how you would declare those -- I'm surprised it's not 
possible (and used!) in C :^))

would look a lot better as:

foobar(x,y,a,b,c,d,e)
int x,y
int *a, etc... /* return values */


However, the comma operator in C might let you do it...

Scott
Newsgroups: comp.programming
From: mdg@netcom.com (Mark Grand)
Subject: Re: Names
Date: Sun, 12 Apr 92 06:26:59 GMT
Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
Distribution: comp
Summary: What a naming scheme should accomplish



>>>>> On Fri, 10 Apr 1992 23:34:28 GMT, aj3u@larch.cs.virginia.edu (Asim Jalis) said:

Asim> Do people have ideas on how to name entities in programs
Asim> (local/global variables, functions, types etc): some sort of
Asim> general guidelines.  I have seen some articles on the Hungarian
Asim> notation and have developed some conventions of my own also.
Asim> However, I remain unsatisfied with this and would like to get

I wish I had an answer for you.  The ideal naming convention would
descriptive allow entities to be classifed in such a way as to promote
reuse of code.  Using such a scheme, if confronted with a large mass
of unfamiliar code, it would be possible to find what you were looking
for by by constructing a name for it.  Since the names would be
descriptive, I should be able to find what I was looking for in just a
few tries.
-- 
Mark Grand
Premenos Corporation                510-602-2036 x2073
1000 Burnett, Second Floor          mark@premenos.sf.ca.us
Concord, CA   94520
Newsgroups: comp.programming
From: rjk@iastate.edu (Russell J Kraemer)
Subject: philosophers problems
Keywords: problems
Organization: Iowa State University, Ames, IA
Date: Mon, 13 Apr 1992 19:30:51 GMT

Hello all, and yes I have read the group for more then a week:).

RE the discussion of the philosophers problem.......I know that these
are various programming exercises, but have never seen them. Would some
kind soul e-mail as many as you have?  My coding could use a work out
and these would seem to fit the bill.

If anyone else is interested, e-mail me and I'll send you whatever I get...
unless its a flood, then 'o course I'll summarize and post.

Thanks!



-- 
rjk@iastate.edu                 

I think therefore I.......shoot, was I saying something?
From: paul@kagaku.se.fujitsu.co.jp (Paul Donnelly)
Newsgroups: comp.programming
Subject: How To Calculate Logarithm?
Date: 10 Apr 92 10:45:16 GMT
Distribution: comp
Organization: Fujitsu Ltd. Scientific systems DEPT., Tokyo, Japan.

Can anyone help me with calculating logarithms - either natural
logarithms or base 2 logarithms? I wish to implement these functions
for *fixed* precision numbers in machine code for use in a data
compression algorithm. I have already implemented two versions myself.
One used the Taylor expansion for ln, but the expansion of ln has
very bad convergence and is woefully slow. A more successful method
was to implement then natural exponential function e^x (which has much
quicker convergence), then to use an iterated search to get the
inverse function natural log. I would try a value - if it was too big
I tried a smaller value; if it was too small, I tried a bigger value.
Each time, I halfed the step size. Thus each call to e^x gave the next
bit of precision for ln(x). I'm still not satisfied, however. I'm sure
the 'C' library funcion uses a much quicker, and smaller algorithm.
Anyone know what it is?? Thanks for any help.

Paul
From: dylan@ibmpcug.co.uk (Matthew Farwell)
Newsgroups: comp.programming
Subject: Re: Reinventing the wheel
Date: 8 Apr 92 11:57:57 GMT
Organization: The IBM PC User Group, UK.

In article <PDS.92Apr2170934@lemming.webo.dg.com> pds@lemming.webo.dg.com (Paul D. Smith) writes:
>The goal of "code reuse" is simply to allow more reliable programs to
>be developed more quickly.  Then you go back and make it better!
>That's the interesting part of coding anyway... :-)  Here're the keys
>to software engineering, as I see them:
>
>  * Good design!  It's hard to sit down cold, hack, and come up with
>    something reasonable at the end.  I like to sit in my chair and
>    spin around for a few minutes first--gets that blood rushing to
>    your head :-)
>
>  * It *has* to be properly modularized, with well-defined interfaces
>    even internally, and you *cannot* break the defined interface
>    *anywhere*!  Be strong!  In the end the little speedup you gain by
>    using that "undefined" feature will be more than taken up by the
>    pain and torture you'll experience if you have to change the
>    underlying functionality...  If there's a real need, rethink your
>    interface a bit.

I agree.  The only thing I don't like about this is doing stuff like
having to return structures from functions around (in C).  I guess C++
would help here.  It just seems ugly to pass back a
{int foobar; char *blurf} instead of a base type.

>    I personally always treat *every* source file as a little
>    mini-library, with a defined interface that I take great pains to
>    keep general and consistent, and up-to-date header files taking
>    full advantage of whatever prototyping, etc. is available in the
>    language and defining relevant types, macros, etc.  You *can* do
>    this in C... you just need more willpower.

Agreed.

>  * Locate and reuse libraries that you find have interfaces that are
>    generic enough that you can rewrite the back-end while having to
>    modify as little of the rest of the program as possible
>    (preferably none!).  I have a "symbol table" library (really a
>    "store and retrieve on keys" library) that I use all over for a
>    multitude of purposes; sometimes I use a hash table under it,
>    sometimes a linked list, sometimes a splay-tree, sometimes even a
>    disk file w/ dbm, etc.  The point is I can swap in and out
>    algorithms without disturbing any of the rest of the code because
>    the *interface* is generic.

If you want to find good functions, which you can reuse again and again,
try looking in the Cnews distribution.  Theres some incredibly useful
stuff in there.

You should also read 'How to steal code' by Henry Spencer, which is a
wonderful read.  You can ftp this from cs.toronto.edu.  If you're
desperate, I can mail it to you, although I only have postscript.

Dylan.
-- 
'If there is a hung parliament, and John Major and Neil Kinnock have
both been hung, then I am willing to take over.  Vote Insanity - you
know it makes sense' - Screaming Lord Sutch
From: russw@cs.utexas.edu (Russ Williams)
Newsgroups: comp.programming
Subject: Re: Programming Standards Question
Date: 15 Apr 1992 21:11:53 -0500
Organization: Great Northern Hotel
NNTP-Posting-Host: cs.utexas.edu

In article <1992Apr14.184343.23104@wdl.loral.com> mab@wdl39.wdl.loral.com (Mark A Biggar) writes:
>In article <1992Apr14.173248.9363@src.honeywell.com> koontz@iasdv1.iasd.honeywell.com writes:
>>...One of the items on
>>the list said that for code reviews one thing that should be 
>>checked is the use of "negative Boolean logic".

Sounds like a lousy book if it uses such a nebulous term without
defining what they mean or giving an example...

>I believe that this is doing something like:
>
>if (some complex condition) 
>	; /* do nothing */
>else {
>	...	/* some complex list of statements */
>}
>This is usualy done when a programmer (falsely) believes that the "complex
>condition" is easier to write than its negation.   The other way this shows
>up is after maintence when there used to be something in the then part but
>it has gone away and the maintence programmer was too lazy to reform the
>if statement the other way.  In any case this is a BAD programming practice.

Any reason why this is a BAD practice?  I'm willing to be enlightened, but
on the face of it this sounds like a pretty dogmatic assertion.  If, after
maintenance, the statement in the "then" part became empty, I don't see
why you'd call the programmer "lazy" not to reform the if statement the
other way.  If it's "some complex condition" it seems smarter to leave
it alone than risk introducing a silly mistake while negating it.

And often a complex condition IS easier to read or write than its negation,
e.g. in

if (isspiffy(x) && iskeen(x)) {
    // x is fine, do nothing
} else {
    // must clean up x
    ...
}

it seems clearer at a glance to me what's meant than in

if (!isspiffy(x) || !iskeen(x)) {
    // must clean up x
    ...
}

or

if (!(isspiffy(x) && iskeen(x))) {
    // must clean up x
    ...
}

The "positive" expression is simpler by any reasonable measure.

The only other reason I can think why you assert it is BAD is from
worrying the compiler won't do as well, but I've never seen a compiler
produce worse code from the version with empty "then" clause.

So what's your reasoning?

Russ
Newsgroups: comp.programming
From: dalamb@qucis.queensu.ca (David Lamb)
Subject: Re: Names
Organization: Computing & Information Science, Queen's University at Kingston
Date: Tue, 14 Apr 1992 17:26:38 GMT

In article <1992Apr12.193508.1732@cs.yale.edu> pharr-matthew@CS.YALE.EDU (Matthew Pharr) writes:
>I have seen occastional reference to 'the Hungarian Notation,' and
>from what I remember it's awfully weird stuff, although it does seem 
>to have its fanatics... Does anyone out there have any references on it?
>

From the comp.software-eng FAQ:

Subject: What is 'Hungarian Notation'?
Date: 19 Sep 1991

 A naming convention for C code.  See Charles Simonyi and Martin Heller, "The
Hungarian Revolution", BYTE, Aug. 1991 (vol. 16, no. 8).  There are other
naming conventions; see, e.g.  "A Guide to Natural Naming", Daniel Keller,
ETH, Projekt-Zentrum IDA, CH-8092 Zurich, Switzerland. Published in SIGPLAN
Notices, Vol. 25, No. 5, pages 95-102.
From: pharr-matthew@CS.YALE.EDU (Matthew Pharr)
Newsgroups: comp.programming
Subject: Re: Names
Date: 12 Apr 92 19:35:08 GMT
Organization: Yale University Computer Science Dept., New Haven, CT 06520-2158

In article <AJ3U.92Apr10183428@larch.cs.virginia.edu>
	aj3u@larch.cs.virginia.edu (Asim Jalis) writes:

>Do people have ideas on how to name entities in programs
>(local/global variables, functions, types etc): some sort of
>general guidelines.  I have seen some articles on the Hungarian
>notation ...

I have seen occastional reference to 'the Hungarian Notation,' and
from what I remember it's awfully weird stuff, although it does seem 
to have its fanatics... Does anyone out there have any references on it?

thanks,
matt
From: bevan@cs.man.ac.uk (Stephen J Bevan)
Newsgroups: comp.programming
Subject: Re: functions & return values (was Re: Reinventing the wheel)
Date: 13 Apr 92 19:48:20 GMT
	<10212@goanna.cs.rmit.oz.au> <3608@caslon.cs.arizona.edu>
Organization: Department of Computer Science, University of Manchester
In-reply-to: dave@cs.arizona.edu's message of 13 Apr 92 14:18:16 GMT

In article <3608@caslon.cs.arizona.edu> dave@cs.arizona.edu (Dave Schaumann) writes:
   ... my objection to what has been suggested so
   far is that it was yet another order-dependant construct.  The more I write
   larger projects, the less I want to have to remember stupid little details
   like parameter order.

The order dependence would be the most _natural_ thing in languages
like C, C++, that don't allow the order independent parameters to
functions/procedures.  Allowing multiple value returns to be order
independent but not function/procedure arguments would be rather
bizarre.  IMHO it is better to allow both to be order independent, but
if I had to choose, I'd rather order independent arguments (can anyone
say Ada :-)

bevan
From: gaynor@blaze.rutgers.edu (Silver)
Newsgroups: comp.programming
Subject: Re: Everything in symbol table (was Re: keywords in the symbol table?)
Keywords: symbol table keyword lexical
Date: 12 Apr 92 15:24:35 GMT
Organization: Rutgers Univ., New Brunswick, N.J.

> A lexer shouldn't know anything about symbol tables.

I kind of agree with you here.  A lexer shouldn't know anything but what you
tell it.  If you want your lexer to know about symbol tables, digital search
trees, and their ilk, supply the functionality yourself using a lexer similar
to the following:

    ;; Perform lexical analysis.
    ;; STT is a state-major state-transition table for the non-ending states.
    ;; Ending states must always be greater than (length STT).
    ;; SFT is a table of state functions, or null.  The Nth element is called
    ;;  on the current state and transition when state N is entered.
    ;; TFT is similarly defined for transitions.
    ;; TSF is the transition stream function.  It is called with no arguments
    ;;  whilst the state is not an ending state.
    ;; Return a cons whose car is the ending state and whose cdr is a list of
    ;;  transitions returned by TSF.
    (define (scan STT  ;; state-transition table
                  SFT  ;; state functions table
                  TFT  ;; transition functions table
                  TSF) ;; transition stream function
      (let ((SC nil)   ;; state (current)
            (TC nil)   ;; transition (current)
            (TH nil))  ;; transition history
        (set! SC 0)
        (and SFT ((vector-ref SFT SC) SC TC))
        (while (< SC (length STT))
          (set! TC (TS))
          (set! TH (cons TC TH))
          (and TFT ((vector-ref TFT TC) SC TC))
          (set! SC (vector-ref (vector-ref STT SC) TC))
          (and SFT ((vector-ref SFT SC) SC TC)))
        (cons SC (reverse! TH))))

Written on the fly and untested, sorry.  Pretty simple, though.

Regards, [Ag]
Newsgroups: comp.programming
From: andy@research.canon.oz.au (Andy Newman)
Subject: Re: functions & return values (was Re: Reinventing the wheel)
Organization: Canon Information Systems Research Australia
Date: Tue, 14 Apr 1992 03:18:52 GMT

In article <10212@goanna.cs.rmit.oz.au> ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes:
>There are many reasons to want multiple assignment; multiple function
>results is just one of them.

Yes. Occam has this (multiple assignment) which leads to the idiom,

	a, b := b, a

to swap the values of two variables.


-- 
Andy Newman (andy@research.canon.oz.au)
Canon Information Systems Research Australia
Newsgroups: comp.programming
From: schwartz@roke.cs.psu.edu (Scott Schwartz)
Subject: Re: Reinventing the wheel
Organization: penn state university, computer science
	<STEPHEN.92Apr8204414@estragon.uchicago.edu>
	<3549@caslon.cs.arizona.edu>
Date: Thu, 9 Apr 1992 22:14:27 GMT

dave@cs.arizona.edu (Dave Schaumann) writes:
   I think that far more often than not, when you wish you could
   return two values from a function, what you really need to do is
   re-examine your data structures, and not redesign the language.

(Ignoring the issue of what C should and should not have...)

You argue that returning multiple values is not as nice as returning a
single structure.  Do you also think that passing multiple values is
bad, and that one should just pass a structure?  That's a common view
in the functional language community (witness ML), and it has certain
advantages.  On the other hand, allowing functions to take multiple
values as parameters, but not to return them is needlessly inconsistent.
From: smoore@dartmouth.edu (Sean Moore)
Newsgroups: comp.programming
Subject: Re: comp.programming is broken
Date: 17 Apr 92 13:11:56 GMT
Organization: Dartmouth College, Hanover, NH

In article <1992Apr16.012127.1445@highland.oz.au> andrew@highland.oz.au (Andrew Morton) writes:

   >Well, Dan, it didn't take long. The signal to noise ratio
   >here is about 10%.  In retrospect the problem is
   >in the name.  'comp.programming' is the first thing
   >that people are going to reach for for a whole
   >range of questions.

   >It should have been comp.algorithms.  Ah well.

I agree.
- S
Organization: City University of New York/ University Computer Center
Date: Saturday, 11 Apr 1992 20:55:18 EST
From: <DECBC@CUNYVM.BITNET>
Newsgroups: comp.programming
Subject:    C-code to compress bit-images on monochrome

Hello everyone:

I am looking for a C function to compress bit-images on
monochrome monitor. Any idea?

Appreciate any help,

lewis
From: markh@csd4.csd.uwm.edu (Mark William Hopkins)
Newsgroups: comp.programming
Subject: Re: Multi-tasking kernel
Date: 12 Apr 92 09:54:02 GMT
Article-I.D.: uwm.1992Apr12.095402.3265
Organization: Computing Services Division, University of Wisconsin - Milwaukee

In article <1992Apr11.122628.2131@nuscc.nus.sg> eletanjm@nuscc.nus.sg (Tan Jin Meng @ NUS) writes:
>cmdorat@tc.fluke.COM (Richard Kowalsky) writes:
>: Hi,  I would like to learn more about embedded multi-tasking operating
>: systems and to that end, I would like to to play arround with one on
>: this little generic 80186 project board I have.
>: 
>
>Why don't you write one yourself? You can in fact write a simple and
>completely portable non preemptive multitasking kernel by just using the
>standard C routines setjmp() and longjmp().
>
>I fact, I vaguely remember such a project in one of the computere
>magazines I've read. I think its Dr. Dobbs. Maybe you can look it up.

There's also a listing for an 8086 multitasking kernel (part in C, part in
assembly) in the magazine, and an entire series of articles written over the
last year on porting the UNIX to 386 machines -- keeping in mind that the 386
is specifically designed for people who write operating systems.

Intel also markets the 376 chip, which is basically the 386 for embedded
applications.
Newsgroups: comp.programming
From: comptec91055@camins.camosun.bc.ca
Subject: Binary Fusion Trees
Organization: Camosun College
Date: Wed, 15 Apr 1992 17:04:25 GMT




		Is anyone familiar with binary fusion trees, and if so are
there any currently implementible algorithms?  How would one go about learning
this new sorting technique?  Is extensive key analysis required?

	D.Rozee
From: dave@cs.arizona.edu (Dave Schaumann)
Newsgroups: comp.programming
Subject: Re: need a HINT on a C code parsing name-strings
Date: 6 Apr 92 23:33:05 GMT
Article-I.D.: caslon.3519
Organization: U of Arizona CS Dept, Tucson

In article <10102@goanna.cs.rmit.oz.au> ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes:
|In article <92096.184215DECBC@CUNYVM.BITNET>, DECBC@CUNYVM.BITNET writes:
|> I am writing a C code to parse an input string formatted in
|> 'lastname,firstname,middle-initial' of each field is varying
|> length and total length is 30 bytes, into three separate
|> strings, 'lastname,' 'firstname,' and 'middle-initial.'
|> 
|> My code doesn't satisfy the efficiency required by my demanding
|> boss. So, folks, I really appreciate it if u would give me some hints.

[...]
|Why is your boss worrying about the efficiency of your code when she
|should be concentrating on FIRING the dolt (I'm being euphemistic here)
|for came up with such a ludicrous input format in the first place?

Am I the only one who thinks this sounds a lot more like an intro-to-CS
homework assignment than a real-world problem?

Consider: we have a very carefully and specifically specified input
structure and length limit, and a `boss' that seems awfully concerned
with efficiency for a function that (unless the programmer is completely
brain-dead (oops, I mean cognitively challenged)) will run at least two
orders of magnatude faster than the routine to read in the data.

-- 
Dave Schaumann			dave@cs.arizona.edu
Newsgroups: comp.programming
From: lowry@watson.ibm.com (Andy Lowry)
Subject: Re: Difference between SCCS and RCS
Date: Fri, 10 Apr 1992 21:14:59 GMT
Disclaimer: This posting represents the poster's views, not necessarily those of IBM
Organization: IBM T.J. Watson Research Center

In article <1992Apr10.164723.18085@dsg.tandem.com> narayan@aravali.everest.tandem.com (Pankaj Narayan) writes:

   Which of thesae is better, and why ?
   I get the feeling that people are moving from RCS to SCCS, but
   haven't been able to figure out why. I use RCS, and find it sufficient.

The only substantive difference I know of is that SCCS maintains
forward diffs from a base consisting of the original text, while RCS
maintains the latest text as a base and has reverse diffs to
reconstruct prior versions.  Sounds like RCS made the right choice,
considering that I almost always want the latest version.  With SCCS,
performance degrades noticeably as revision histories grow.

-Andy
--
Andy Lowry, lowry@watson.ibm.com, (914) 784-7925
IBM Research, P.O. Box 704, Yorktown Heights, NY  10598