HDTenEightyP/NetNews huggingface dataset:
From: mayer@teal.csn.org (Mike Mayer)
Subject: Re: *** IMPORTANT DISCOVERY ***
Organization: Colorado SuperNet, Inc.
X-Newsreader: Tin 1.1 PL4
Date: Wed, 18 Nov 1992 23:49:46 GMT

Lucky me.

This is the first time I have ever checked out comp.lang.c.  This article
was exactly the second one that I decided to read (it caught my
attention).  I'll have to check into more newsgroups that I have
not read to see what they are like.

For the curious, the first one I read was apparently by a student
trying to get someone to write his program for him 
the title was "Can you program in C?"

Mike4Mayer

-- 
___---^^^---___---^^^---___---^^^---___---^^^--- Catch The WAVE ---___      
Michael Mayer, Senior Technical Support Engineer   
Precision Visuals, Inc. 32915 Aurora Rd. Suite # 160, Solon, OH, 44139  USA
Email: mayer@pvi.com   Human: 216/248-4900   Fax: 216-248-2733
Newsgroups: comp.lang.c
From: jmeri@cs.joensuu.fi (Juha Meriluoto)
Subject: BCD arithmetic
Organization: University of Joensuu
Date: Tue, 17 Nov 1992 12:42:33 GMT

I am working on a project that needs BCD arithmetics.
Could anyone give me pointer(s) to BCD arithmetics packages
written in C (preferably public domain, I don't have money to
spend on this one...)  Thanks in advance!

	JMe

-- 
******************************************************************************
Juha Meriluoto    e-mail:   jmeri@cs.joensuu.fi
                  letters:  Nuottaniementie 16 A 9  80140 JOENSUU  FINLAND
                  phone:    +358-49-379040 
Newsgroups: comp.lang.c
From: jbr0@cbnews.cb.att.com (joseph.a.brownlee)
Subject: Re: Will we keep ignoring this productivity issue?
Organization: AT&T
Date: Tue, 17 Nov 1992 13:24:19 GMT

In article <1509@gistdev.gist.com> flint@gistdev.gist.com (Flint Pellett)
writes:
> rcd@raven.eklektix.com (Dick Dunn) writes:
> > ....  On the
> > other hand, we seem to think we've got enough good programmers that we can
> > afford to spend them cleaning up code of a sort they'd never write in their
> > worst drunken stupors.
>
> > Well, I'm no Van Jacobson, but I've certainly had to spend extended periods
> > working on code of a quality for which I would have flunked my first
> > -semester programming students 15 years ago.
>
> This looks to me like an area that someone ought to devote some study to:
> it would be interesting, at the very least, to get some feel for what
> percentage of their time top programmers spend cleaning up after the
> others, (or in consulting/teaching others) and then formulate some
> methodologies for eliminating THAT problem.  If the top people are
> spending half their time cleaning up junk, you have a potential doubling
> of productivity right there.  [...]

I think both Dick and Flint have hit on something here.  I have spent most of
my career cleaning up old messes left by others.  Often this is the type of
task a new person coming in to a job is asked to tackle.  If you are good at
doing it, your reward is going to be to get more bad code thrown at you.  I
just try to remind myself that bad programmers are creating both entertainment
and job security. :-^

It seems to me that most of the bad code I've seen was primarily written by
one of two types of people:  either by someone who was completely out of their
element such that they had no clue what they were doing, or by a person who
knows enough to be able to do the right thing but is too sloppy to sweat the
details.  Often, the latter case will be said to be the result of time pressure
(though I must question why creating bad software quickly is such a virtue,
especially when it seems to be so easy to do).

I wonder if these are not more management problems than anything else.  In both
cases, the person is set up to fail.  Obviously, it makes more sense to place
people in situations where they can succeed.  We have to keep the clueless
people from creating messes in the first place, and work with the sloppy ones
to get them to clean up their act, and try to convince managers that reasonable
schedules actually save lots of money (they do).  The only other alternative is
to get these people out of the way of the good ones entirely, and I don't think
that is going to happen any time soon.
-- 
   ^      _   Joe Brownlee, Analysts International Corp. @ AT&T Network Systems
  /_\  @ / `  471 E Broad St, Suite 2001, Columbus, Ohio 43215   (614) 860-7461
 /   \ | \_,  E-mail: joe@cbcosmos.att.com   Yes, I speak for my company - NOT!
 "Scotty, we need warp drive in 3 minutes or we're all dead!" --- James T. Kirk
From: folsom@bigmax.UUCP (Al Folsom)
Newsgroups: comp.lang.c
Subject: Re: Will we keep ignoring this productivity issue?
Summary: Not here, please?
Date: 18 Nov 92 13:24:59 GMT
Organization: Fischer & Porter Co., Warminster, PA.

I'm sure this group therapy is all very valuable, and we'll all feel
much better about ourselves later, but hasn't this thread drifted
away from the topic of C?  

Would you mind carrying on in a more appropriate newsgroup?

Al F.

+-------------------------------------------------------------------+
| Al Folsom                 | Object Oriented Programming?  We've   |
| Fischer & Porter Co.      | been doing that for years...          |
| ...uunet!bigmax!folsom    |                                       |
| also folsom@decus.org     | When the customer objects to the way  |
| KY3T@WA3TSW (Ham)         | it works, we go program some more!    |
+-------------------------------------------------------------------+

Newsgroups: comp.lang.c
From: pdh@netcom.com (Phil Howard )
Subject: Re: CRC-32 C code needed
Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
Date: Thu, 19 Nov 1992 20:39:07 GMT

a7657@mindlink.bc.ca (Stephen H. Kawamoto) writes:

>                  for ( c = i << 24, j = 8; j > 0; --j)
>                            ========
>                             this loses bits

If you need to keep more than 8 bits, then you need to do something else.
If 8 bits is all you need to keep (in c) then you need to declare "i" as
an (unsigned long) which will have a minimum the needed room to shift.
Of course "c" will have to be that big just to hold those 8 bits on the
high order end.  Or you can cast it (parenthesis are just a practice to
make SURE things are evaluated in the desired order, using the rule that
says multiply and divide are done before add and subtract and put EVERYthing
else in parenthesis):

        c = ( (unsigned long) i ) << 24;
        for ( j = 8; j > 0; --j)


>        and when the table is built,
>
>                        crc = (crc << 8 ) ^ crc_table[(crc >> 24) ^ *p];
>                                                       =========
>                                                       this loses significent
>                                                       bits

Again, "crc" itself needs to be a 32 bit number AND you are only going to be
keeping the high order 8 bits.

And be sure EVERYTHING with bits in it is declared as UNSIGNED.



>                       is there a better way to do this?
>
>Stephen Kawamoto <a7657@mindlink.bc.ca>

Maybe.  You didn't show enough code to make judgements.  I'll send you
a copy of my code by e-mail (tarred, compressed, and uuencoded) which
you can study, compare, extract or use (even though it is still just in
beta test).
-- 
/***********************************************************************\
| Phil Howard  ---  KA9WGN  ---  pdh@netcom.com   |   "The problem with |
| depending on government is that you cannot depend on it" - Tony Brown |
\***********************************************************************/
From: fzjaffe@othello.ucdavis.edu (Rory Jaffe)
Newsgroups: comp.lang.c
Subject: converting unsigned int to signed int
Date: 14 Nov 92 22:37:47 GMT
Organization: University of California, Davis

What is a safe, portable method of converting from signed int to
unsigned?  I want the most negative signed value to convert to 0, and
the most positive signed value to (max signed int) + abs(max negative
signed int).
Newsgroups: comp.lang.c,comp.lang.c++,comp.lang.misc
From: robert@triton.Jpl.Nasa.Gov (Robert Angelino)
Subject: Recommendation for Devlopment environment in C and/or C++...
Reply-To: robert@triton.Jpl.Nasa.Gov
Organization: Jet Propulsion Laboratory, Pasadena CA
Date: Mon, 23 Nov 1992 22:18:55 GMT

HI!!  I'm in the process of selecting a development env. for C and
C++ and was wondering if someone out there has done a thorough 
evaluation of development environments.  So far I've looked at
Energize and CodeCenter.

Any recommendations are welcome.

thanks

-robert
From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe)
Newsgroups: comp.lang.c
Subject: Re: qucik, merge, shell and bubble sort
Date: 17 Nov 92 04:55:48 GMT
Organization: Comp Sci, RMIT, Melbourne, Australia

In article <1e1cnvINNt2t@usenet.INS.CWRU.Edu>, cc015@cleveland.Freenet.Edu (Vito T. Kwan) writes:
> Hi all,
> 	I want to take a look at these four sorting method in C, does anyone
> know where can I get (ftp) them?
> 	Thankss in advance

Costs:
	Bubble sort is O(N**2).  It has no known uses.  It is bad even for
	an O(N**2) algorithm; if you want a very simple sorting algorithm
	you can remember and that will work well, pick insertion sort.

	Shell sort is O(N**1.5) -ish.  It has no special advantages.

	Quick sort is O(N**2) in the worst case.  It is complicated and
	unstable.  Its _average_ cost is O(N.lgN).  The only known reason
	for using quicksort is if you are DESPERATELY short of memory; it
	was invented for use on a computer with 256 words of main memory.
	(Read Hoare's paper in Computer Journal 1961.)  At the time it was
	invented, it was known to be inferior to merge sort by every metric
	except space, and if you are sorting a list it doesn't save any
	space either.

	Merge sort is O(N.lgN) in the worst cast.  If the comparisons are
	not trivial (i.e. if the compiler does not know at compile time that
	they are machine integer comparisons) then the *worst* case of
	merge sort is better than the *best* case of quick sort.

Of the four methods, the only one that can be recommended for general use
is merge sort.  If you have to write a sort routine for an embedded controller
or some other application where there is almost no main memory and no backing
store, quick sort is useful.  For everyday programming in C, you should try
using the built-in qsort() function.  Most C libraries I have come across use
some version of quick-sort, which makes them rather slow, but at least it is
there and debugged.

Your best source of such algorithms would be a textbook like
Sedgewick's "Algorithms in C".

Newsgroups: comp.lang.c
From: hansm@cs.kun.nl (Hans Mulder)
Subject: Re: The Correct Way To Write C if-Statements
Organization: University of Nijmegen, The Netherlands
Date: Tue, 17 Nov 1992 18:49:21 GMT

In <1992Nov16.175117.29633@dg-rtp.dg.com> goudreau@robin.rtp.dg.com (Bob Goudreau) writes:

>Actually, this isn't quite right.  The K&R style is to align the
>terminating brace with the first letter of the "if" (or "while",
>etc.):

>    if (cond) {
>        ugly_statements;
>    }


But if you format your statements that way, they're no longer ugly, ergo:

	if (cond) {
	    beautified_statements;
	}

:-)

--
Hans Mulder				hansm@cs.kun.nl
From: dfuller@portal.hq.videocart.com (Dave Fuller)
Subject: Re: How to malloc an array of pointers?
Organization: VideOcart Inc.
X-Newsreader: Tin 1.1 PL3
Distribution: usa
Date: Thu, 19 Nov 1992 14:06:10 GMT

sbtaves@icaen.uiowa.edu (Steven Bradley Taves) writes:
: Hi all,
: 
:     I'd appreciate it if someone could tell me how I can allocate memory
: for an array of pointers and for the strings they will be pointing to.
: 
: I have  
:        char *Var[];
: 
: Normally for
:        char *Var;
: you do
:        Var=(char *)malloc(10*sizeof(char));
: for a string of 10 characters.
: 
: I want to allocate memory for 10 strings of ten characters.  Also, how
: do I allocate memory for the pointers themselves?
: 

try this:

instead of char *Var[] -> char *Var[10]  (since you know you have 10)
this will also allocate the memory for you automatically (for pointers)

then without any error checking of course

for (i = 0; i < 10; i++)
   Var[i] = (char *) malloc(10 * sizeof(char));

thats all.

Dave Fuller
dfuller@portal.hq.videocart.com

Newsgroups: comp.lang.c,comp.software-eng,alt.folklore.computers
From: rmaszkow@nyx.cs.du.edu (Rafal Maszkowski)
Subject: how to chech free space on NFS partition on Sun 4.1?
X-Disclaimer: Nyx is a public access Unix system run by the University
	of Denver for the Denver community.  The University has neither
	control over nor responsibility for the opinions of users.
Organization: Nyx, Public Access Unix at U. of Denver Math/CS dept.
Date: Sun, 22 Nov 92 21:52:56 GMT


Which function should I use to find how many B/blocks are free on NFS
partition?

Rafal
From: 2644danticoj@vms.csd.mu.edu
Newsgroups: comp.lang.c
Subject: An apology to the world
Date: 21 Nov 1992 17:27:15 GMT
Organization: Marquette University - Computer Services
Reply-To: 2644danticoj@vms.csd.mu.edu
NNTP-Posting-Host: vmsa.csd.mu.edu

Greetings--

It's Cetera again, and for the record, this will be his final logon to this
network. Rest assured C programmers, my posting of 16NOV92 was a joke, although
I'll admit I was interested in seeing the response it would generate. I thank
all for their colorful replies. And having created quite a stir in a world in
which I don't belong, I heart-fully offer this sincere apology. Frankly,
creating a stir is not enough to keep me from sleeping at night, but it appears
that I have sent a very poor picture of a school which I cherish deeply and may
have potentially effected its reputation. And this is the reason I apologize. 
I beg of you to not frown upon Marquette, as it is indeed a school worthy of
praise, and I had no intent of portraying a bad image.I apologize to all. Most
of all, however, I apologize to the entire Marquette community, and
specifically to Mrs. Mary Boelk and Frank Barnard (the latter of whom I
understand is going to give me "pep-talk" on the proper uses of a network such
as NEWS). Having said my apologies, I must now bid the world adieu and move on 
to other things. Again, I thank all who replied for their creative responses, 
and apologize from the very bottom of my heart. Cheers to all...

						Cetera
From: dik@cwi.nl (Dik T. Winter)
Newsgroups: comp.lang.c
Subject: Re: Rounding floating point numbers in C
Date: 22 Nov 92 02:00:23 GMT
Organization: CWI, Amsterdam

This is not in the FAQ, but perhaps something should go there about the
inexactitude of FP arithmetic and FP constants.

In article <1992Nov20.215133.3271@enterprise.rdd.lmsc.lockheed.com> gumerman@aspen.ops.lmsc.lockheed.com () writes:
 > The way numbers are rouned is totally inconsistent.  Sometimes numbers are 
 > rounded up sometimes they are rounded down.  What is going on here?
It is, in a way.  Note that not all numbers are exactly representable on
the machine.
 > 
 > 1.15      1.1   /* round down */
 > 1.25      1.3   /* round up  */
 > 1.35      1.4   /* round up  */
 > 1.45      1.5   /* round up  */
 > 1.55      1.5   /* round down */
 > 1.65      1.6   /* round down */
 > 1.75      1.8   /* round up  */
 > 1.85      1.9   /* round up  */
 > 1.95      2.0   /* round up  */
Of these only 1.25 and 1.75 are exactly represented on your machine, so the
others have representations that are slightly larger or slightly smaller
than the presented value.  This influences the rounding.  (Looking at the
numbers, 1.15, 1.55 and 1.65 are represented slightly smaller; taking a
lot of time it is even possible to deduce a lot of the properties of the
fp system and fp conversion of your machine.)
-- 
dik t. winter, cwi, kruislaan 413, 1098 sj  amsterdam, nederland
home: bovenover 215, 1025 jn  amsterdam, nederland; e-mail: dik@cwi.nl
Newsgroups: comp.lang.c
From: dfuller@portal.hq.videocart.com (Dave Fuller)
Subject: Re: Multiple Parameter Passing (unspecified number)
Organization: VideOcart Inc.
X-Newsreader: Tin 1.1 PL3
Date: Mon, 16 Nov 1992 19:57:16 GMT

GNR100@psuvm.psu.edu writes:
: 
:    Hi.
: 
:    I'm looking to write a function that accepts any number of paramerter.
: There will be at least two, an int and a char[]. The rest will all be char[]'s.
: I need to know how this is done.  The meathod would be similar to that of
: printf(), so if anybody know how that works, please let me know.
:                  Thanks,
:                      Gordon Rogers
:                      gnr100@psuvm.psu.edu


Gordon,
    Sort of depends. UNIX versions will use definitions from varargs.h and 
non-UNIX platforms use stdarg.h (I believe these are the correct header files).

UNIX versions use va_dcl, va_start, va_end, va_arg, va_list, and va_alist
non-UNIX versions use va_end, va_arg, va_list
                      and va_start (with 1 extra parm)
(not all of these are macros. va_alist, va_dcl, and va_list are variables)

I haven't used varargs in a while so this may not be complete.

Sorry this is not a full-blown answer, but if it doesn't get you headed
in the right direction, write me. As i said, i will respond with full
functional usage of the variable argument scheme.


Dave Fuller
dfuller@portal.hq.videocart.com
From: scjones@thor.sdrc.com (Larry Jones)
Newsgroups: comp.lang.c
Subject: Re: Array of pointers to constant functions?
Date: 20 Nov 92 17:56:59 GMT

In article <41289@sdcc12.ucsd.edu>, cs161feu@sdcc10.ucsd.edu (Anthony Minkoff) writes:
> 
> I want to declare an array of pointers to constant functions.  (Is
> that last bit redundant?)  I.e., what I want is an array of pointers
> to functions.  Each of these functions is defined at compile time,
> and I'd rather not have to give a name to each of these functions
> (except, of course, for the name of the array).

C functions are like string literals: they're not actually "const", but
you're not allowed to try to change them, either.  The only way you can
even declare a const function is by using a typedef and ANSI C
explicitly makes that undefined behavior.  C does not support anonymous
functions, so you will have to give them all names.  Something like:

	static void f1(void) { printf("one\n"); }
	static void f2(void) { printf("two\n"); }

	void (*a[])(void) = { f1, f2 };
----
Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH  45150-2789  513-576-2070
larry.jones@sdrc.com  or  ...uunet!sdrc!larry.jones
Something COULD happen today.  And if anything DOES,
by golly, I'm going to be ready for it! -- Calvin
From: syzygy@rhps.chi.il.us (Eric Swanson)
Newsgroups: comp.lang.c
Subject: BC++ 3.1, 386 instructions, register parameters.
Date: Sat, 21 Nov 92 13:19:01 CST
Organization: CrissySoft Incorporated

I posted this on another newsgroup but I think this is a better one to post
on..  I've been trying to use Borland C++ 3.1 with the 80386 instruction set
enabled and use register parameter passing as opposed to good old C param
passing.  Here's my code fragment:
 
#include <iostream.h>
 
 
long func(long a, long b)
{
    if (a != b) cout << "Error!\n";
    return 0L;
}
 
void cdecl main(void)
{
    func(12345678L,12345678L);
}
I've read all the manuals and everything they say about register parameter
passing to no avail.  Making nmo changes to the project except for instruction
set and entry/exit codes, I get the following results:
8086 instructions, C param passing: works correctly (no output).
8086 instr, register param passing: works correctly.
80286 instr,  C params: correct
80386 instr,  C params: correct
80386 instr, register param passing: prints "Error!". 
    In fact, the only time it doesn't work is with '386 instructions and
register parameter passing.  I had the compiler generate ASM code to see what
it's doing, and it appears that max (the second param) is being pushed onto the
stack, then min is being put into EAX.  No problem there, makes sense.  However
the callee seems to be lookng in DX:AX for the first parameter!!  Am I missing
something, or is this a horrible bug?

 --Eric Swanson
From: steve@taumet.com (Steve Clamage)
Subject: Re: What is meant by: double A[n,m]?
Organization: TauMetric Corporation
Date: Wed, 18 Nov 1992 17:20:26 GMT

torstein@itekiris.kjemi.unit.no (torstein hansen) writes:

>As a newcomer to C, previously programming in Pascal, I used the
>following declaration in one of my programs:

>double A[n,m];

>I assumed (erronously) that this would give a n by m matrix. But
>obviously, it didn't.  But the compiler never gave any errors or
>warnings, and using 

>  A[rownumber,colnumber]=some_value;
> 
>was also accepted by the compiler.  I'm not asking for the correct 
>way to define an array, I found that out quickly, but what is meant 
>by A[n,m]?  It seems like the compiler just ignores the n and makes 
>it A[m].  This is also the case when assigning values to the array.

Right.  The declaration
	double A[n, m];
is not strictly conforming C code, but many (most) compilers allow
the comma-expression inside the brackets.  The "n" is ignored and
the declaration is equivalent to
	double A[m]
as you surmised.

The expression (as opposed to declaration)
	A[x, y]
is perfectly legal, having a comma-expression inside the brackets.
The 'x' on the left side of the comma is evaluated and the result is
ignored.  Except for side effects of evaluating 'x', the expression
is equivalent to
	A[y]

The difference is that a declaration of an array requires a constant-
expression for the size, and a constant-expression may not contain a
comma-expression.  Many compilers allow it anyway, as long as the left
side of the comma is a constant-expression.

The C Standard is not absolutely clear on this point for declarations.
In one place it forbids a comma-expression, and in another it says it
is an allowable extension.

-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
Vice Chair, ANSI C++ Committee, X3J16
Newsgroups: comp.lang.c,comp.software-eng
From: shanks@saifr00.cfsat.honeywell.com (Mark Shanks)
Subject: Re: Will we keep ignoring this productivity issue?
Organization: Honeywell Air Transport Systems Division
Date: Tue, 17 Nov 92 14:23:32 GMT

In article <1992Nov17.003350.2649@tcsi.com> miket@hermes.tcs.com (Michael Turner nmscore Assoc.) writes:

>This still begs the question of whether high programmer productivity is
>something that can be taught.  How you get to where you get in something
>like programming is very much a function of how much you love it.
>As with many areas of expertise, there is no shortage of people who
>are in love with the image of themselves as superior programmers.
>But how many really live for the game itself?  Those, I think, are
>the superprogrammers.  Can love of programming be taught?

No, no more than fastidiousness can be taught, or leadership, or
to stretch, musical genius, superior athletic ability, or how to
write a best seller. I'm not convinced that the "superprogrammers"
feel that "living for the game itself" is the source of their talent.
As an example (poor one, maybe), I offer Salieri as portrayed in
"Amadeus": love of composition was not sufficient to overcome an
inherent inferior ability. Surely you can think of many aspects of
human endeavor where there are hundreds - thousands of people who
deeply love the subject, even having a greater technical understanding
of the principles involved, but who on their best day couldn't
hope to partake in any meaningful way. Can football fans play? Can
opera lovers sing? 

I'll admit that your "superprogrammers" probably love what they do,
but so do a lot of non-super programmers. I maintain that superior
programming ability is inherent; it can be developed in those who
who have it, but you can't teach it any more than you could turn a
tennis star into a stock broker or an orchestral conductor into 
a neurosurgeon.

Now, about the mediocre programmers: do THEY love what they do?
If not, WHY are they doing it? And if they DO, why are they mediocre?

Mark Shanks
shanks@saifr00.cfsat.honeywell.com