HDTenEightyP/NetNews huggingface dataset:
From: ceblair@ux1.cso.uiuc.edu (Charles Blair)
Subject: PC implementation of CWEB?
Organization: University of Illinois at Urbana
Date: Fri, 13 Nov 1992 15:32:51 GMT

   I understand that H. Bode has an implementation of an extension of cweb
on an ftp site, but have forgotten the address.  Thanks for any help.
Newsgroups: comp.lang.c
From: dfuller@portal.hq.videocart.com (Dave Fuller)
Subject: Re: To Recurse or NOT to recurse?
Organization: VideOcart Inc.
X-Newsreader: Tin 1.1 PL3
Date: Fri, 6 Nov 1992 22:28:43 GMT

sjs@netcom.com (Stephen Schow) writes:
: What is better to do when traversing a linked list..... SHould I use recursion
: to search down through the list for the last node, or should I use a while
: loop?  What or the pro's and con's of each?
: 
: Thanks in advance
: ------------------------------------------------------------------
Stephen,
  If you only want to get to the end of the linked list, definitely use
a while loop. Recursion in a linked list would eat up alot of stack space
and funtion calling overhead for such a simple process.
 
Recursion would, however, be the choice if you need to do an operation that
needs to keep a state constant. Menuing functions are good examples of this.
If one menu calls another, you want the first one to remain in the same state
when the second one gets aborted and the first one becomes active again.
Without recursion, this would be a mess to try to keep all of the
information active in one instance of a function. Instead, you let
each instance keep track of only what it needs to.
 
although there probably are exceptions, the only good time for recursion
is when code will be reused and needs to keep each state of its instance
completely independant of the others.
 
back-and-forth wandering through the linked list would be a good case for
this, but just locating the end of the list would be much easier and
faster with a while loop.
 
dave fuller
dfuller@portal.hq.videocart.com
 

Newsgroups: comp.lang.c,alt.sources
From: smr@pki-nbg.philips.de (Stephen Riehm)
Newsgroups: comp.lang.c
Subject: Re: The Correct Way To Write C if-Statements
Date: 11 Nov 92 10:30:54 GMT
Reply-To: smr@pki-nbg.philips.de

chaplin@keinstr.uucp (Roger Chaplin) writes:

>Mark Boolootian (booloo@framsparc.ocf.llnl.gov) wrote:
>: 
>: The following piece was written by Jim Minton, an aspiring C programmer.
>: I convinced him to let me post it to the net.  Happy reading and flames
>: to /nev/dull...
>: 
>: 
>: 
>: 		The Correct Way To Write C if-Statements
>: 				by
>: 			    Jim Minton

>[ stuff deleted ]

>: The indentation level is 4 spaces!

>FWIW, I also happen to prefer 4-space indentation.

>Did y'all notice, however, that the title of this piece has been
>centered in the `page' by using TABs, and that each TAB is obviously
>intended to replace 8 spaces?

now you're getting confused. The "indentation level is 4 spaces", it
doesn't say 'indentation level is a 4 space tab'.

If you use tabs, then there is a 99.9% chance that the next guy that
reads your code will be disgusted by the fact that you used an
indentation level of 8 (since that is the normal tab length).

If you are using vi you can use the shiftwidth setting and shifting
commands to indent your code. Also having autoindent set helps.

ie: set ai sw=4

SHIFT COMMAND	INSERT MODE	COMMAND MODE
-------------	-----------	------------
indent		^T		>>
outdent		^D		<<
no indent	0^D		[no command, use << many times]

I don't use emacs, but I have seen emacs users using something
similar.

The concept of setting tabs to 4 spaces wide sickens me, simply cus
normally very very very very very few people have tabs set to anything
but 8 characters. (myself included)

catchya

-----------------------------------------------------------------
Stephen Riehm		Configuration Management	   _-_|\ 
smr@pki-nbg.philips.de	Philips Kommunikations Industrie  /     \
Work: +49 911 526 2975	N|rnberg, Germany		  \_.-.!/
Fax:  +49 911 526 3678	"I was there, now I am here!"	       v 
"My company speaks another language, I CAN'T speak on its' behalf"
Newsgroups: comp.lang.c
From: shulick@acoma.ucs.indiana.edu (Sam Hulick)
Subject: IOT traps and/or bad zones on 680x0 series
Originator: shulick@acoma
Reply-To: shulick@acoma.ucs.indiana.edu
Organization: Vallen Software
Date: Fri, 13 Nov 1992 19:56:48 GMT


Does anyone know of any abnormalties in free() on all 680x0 series
machines? (i.e. 68000 CPU, 68030, etc.).  I've noticed that my program,
when run on a Sun or PC, generates no problems whatsoever.  However,
when run on an Amiga (68030 CPU) or a NeXT (68040), it crashes miserably
with this error:

memory allocation error: attempt to free or realloc space not in heap
bad zone
IOT trap

And from what I've tried to debug and scan through, I see no possible
errors.  But what the program is doing is, declaring:
  char *varg[20];

  A function is called and is passed "varg", which is malloc()'d within
said function.  Upon quitting, I run througgh a loop 0-19 and
free(varg[x]) where x is the 0-19 counter.  But on free(varg[0]), a
crash occurs.. only on the 680x0 machines.  Just wondering.. any advice
would be helpful, but please don't ask for the code.  i've already
distributed it to lots of locals.  I'm just wondering why something
would crash on a 68030 or 68040 but not on a Sun or PC (80386).  Thanks.

-- 
Sam Hulick          | "You can't discover new oceans unless you have the
shulick@indiana.edu | courage to lose sight of the shore."  --Anon.
(NeXTmail welcome)  |
Newsgroups: comp.lang.c
From: s0470309@let.rug.nl (P. Wiese)
Subject: Re: Zapping TSR's
Organization: Faculteit der Letteren, Rijksuniversiteit Groningen, NL
Date: Mon, 9 Nov 1992 16:55:40 GMT

In article <rbassadi.4.0@cs1.uct.ac.za> rbassadi@cs1.uct.ac.za (R BASSADIEN) writes:
>From: rbassadi@cs1.uct.ac.za (R BASSADIEN)
>Subject: Zapping TSR's
>Date: Mon, 9 Nov 1992 11:10:01 GMT
>HELP!!!!
>
>I know how to:
>Program a working TSR.
>
>I need to know how to:
>Enable my TSR to unload itself (command line or other).
>Allow my TSR to detect that it has already been loaded.
>
>I use:
>Borland Turbo C. v2.0
>I use the KEEP command (prototype in DOS.H) to get my program to go TSR.
>
>Please help. Thanks.
>
>PS. Post you reply to this newsgroup since there might do others who would 
>    like to know this. (If possible).
>
> Aceman, alias Doc, alias Blank magic.
Newsgroups: comp.lang.c
From: sumargoh@serss0.fiu.edu (H. Sumargo)
Subject: How to simulate an ISDN BRI channel through RS-232?
Reply-To: sumargoh@fiu.edu
Organization: FIU Electrical & Computer Engineering
Date: Thu, 5 Nov 1992 15:22:23 GMT

I would like to be able to connect two computer remotely through the RS-232 and be able
to send information as packet switch at a speed 192 KBPS.  I wonder if someone on the
net has eve done this.

If the above mentioned subject does not sound familiar, instead, I would like to ask
if it is possible to communicate through RS-232 at 192 KBPS?  Could someone please
email me some pointers or may be the c source code to setup the RS-232 link for
192KBPS or higher?

I would appreciate if you please email me your response to sumargoh@fiu.edu.  Thank
you very much.
Newsgroups: comp.lang.c
From: mccall@mksol.dseg.ti.com (fred j mccall 575-3539)
Subject: Re: Hows this for odd
Organization: Texas Instruments Inc
Date: Tue, 10 Nov 1992 16:10:08 GMT

In <1992Nov9.231340.10201@ptcburp.ptcbu.oz.au> michi@ptcburp.ptcbu.oz.au (Michael Henning) writes:

>bena@yoyo.cc.monash.edu.au (Ben Aveling) writes:

>>Just recently I saw the following fragment of code, and I thought I'd share
>>it with you all.  (This is real code, part of a real program people will
>>pay money for.)

>>	... ,(i==0)?TRUE:FALSE,...

>From the source code for a popular UNIX debugger:

>	if (strncmp(p, "", 1) != 0) {
>		...
>	}

>There are lots of gems like that around :-(

Well, I generally do the explicit comparison on string comparisons,
too, because I ran into at least one compiler that would fail to
return the 'correct' answer if the result was negative (it would claim
'false', even though a non-zero ought to be true).  Yes, this compiler
was broken, but given the choice between working around where it was
broken and having my code be broken, I chose the former.

I'm afraid I find this other idiom ("(i==0)?TRUE:FALSE") to be just a
bit peculiar, though.  Someone else made the point that TRUE and FALSE
might have been redefined to some 'program specific' values, but why
write code that works against the language by defining your own
'special' TRUE and FALSE values?

-- 
"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.
From: fred@si.ibp.fr (Frederic PETROT)
Newsgroups: comp.lang.c
Subject: catching Ctrl-C
Date: 4 Nov 92 13:17:20 GMT
Organization: Laboratoire MASI, Paris, France

Hello,

I'm having trouble catching SIGINT under an X11 application.
Other signals, like SIGFPE, SIGBUS, and so on (it's kind of a debugger),
work all right, but I guess it's because it doesn't deal with user input.

My code looks like

main()
{
 .......
	trap();
	setjump(context);
 .......
}

trap()
{
........
	signal(SIGINT, ctrlc);
	signal(SIGTERM, terminate);
	signal(SIGBUS, buserr);
.......
}

terminate()
{
....
	signal(SIGTERM, terminate);
....
	longjmp(context, 0);
}

Some precision :
when I hit  in the shell running the application, or send a kill -2 on the
application in background, the signal is seen and well trapped.

What am I supposed to do so my program listen to the interuption?

Thanks for any pointer!

P.S.
The last time I posted a news, my e-mail header was corrupted, please
use petrot@masi.ibp.fr.
+------------+                        +-----------------+
|            |                    +---+ Frederic PETROT |
+---------+--+     |        |     |   +---------+-------+
        +---+      |        |     |        |            
  +--- / \+/ \ ----+------- | ----+---------------------+
  |   /   /   \             |     |     Equipe CAO&VLSI |
  |  +---+ \   \            |     |    Laboratoire MASI |
  |   \   \ +---+           |     |        |            |
  |    \   /   /            +--------------+            |
  |     \ / \ /   Couloir 55-65, 2eme etage, Bureau 201 |
  |      +---+    Universite Pierre et Marie Curie (P6) |
  +-------------- 4 place Jussieu, 75252 Paris Cedex 05 +
      Tel:      44.27.54.15  Fax: |         44.27.62.86
      Telex: UPMCSIX200145F  e-mail: petrot@masi.ibp.fr
Xref: sparky comp.lang.c:16197 talk.bizarre:37343
From: mjd@saul.cis.upenn.edu ("[*] Angel of Sickness")
Newsgroups: comp.lang.c,talk.bizarre
Subject: Re: The Correct Way To Write C if-Statements
Date: 9 Nov 92 06:02:59 GMT
Followup-To: misc.misc
Organization: Eaters of Wisdom
In-reply-to: njr@texhrc.uucp's message of 7 Nov 92 16:56:03 GMT

In article <1992Nov7.165603.14863@texhrc.uucp> njr@texhrc.uucp (Nick J. Rees) writes:
>   How about when do you use 'if ... else' and when do you use
>   'switch'? 

That's easy.  You use `switch' whenever possible, and never otherwise.
--

                And for to se, and eek for to be seye
Mark-Jason Dominus 	  			    mjd@central.cis.upenn.edu 
Newsgroups: comp.lang.c
From: bandy@netnews.jhuapl.edu (Mike Bandy)
Subject: Re: Returned struct
Organization: JHU/Applied Physics Laboratory
Date: Sat, 7 Nov 1992 06:04:07 GMT

sl14@crux3.cit.cornell.edu (Stephen Lee) writes:

>How can one make use of a struct returned by a function?  e.g.

>struct complex complex_add(struct complex a, struct complex b);

>I tried

>struct complex z1, z2, z3;

>z1.x = 0; z1.y = 3;
>z2.x = 5; z2.y = 4;

>z3 = complex_add(z1, z2);

>But BC++ 2.0 complained 'illegal structure operation' on the above.
>Note:  I'm using C, not C++.

I'm not familar with BC++ but in my old VAX/VMS days I saw this sort of thing
happen when the size of the thing being passed/returned was too big to be
pushed on the stack or loaded into a register or something like that.  The
solution was to pass/return the ADDRESS of the structure.  So I'd change
the routine to look like:

  complex_add(struct complex *a, struct complex *b, struct complex *result);

Then references to variables withing complex_add() have to change like:

  result->x = a->x + b->x;

And the call becomes:

  complex_add(&z1, &z2, &z3);

-- 

	Mike Bandy
	bandy@aplcomm.jhuapl.edu
	Johns Hopkins University / Applied Physics Lab
From: davidg@polvadera.dartmouth.edu (David Gelhar)
Newsgroups: comp.lang.c
Subject: Re: Order of evaluation
Date: 9 Nov 92 06:53:42 GMT
Organization: Dartmouth College, Hanover, NH

In article <qBak-G@ppcger.ppc.sub.org>  writes:

> 
> Let's take a look at Section A7.6:
> 
>    A7.6 Multiplicative operators
> 
>      The multiplicative operators *, /, and % group left to right.
>    [ ... ]
> 
> So the world seems to be OK. But look at Section A7:
> 
>    A7 Expressions
> 
>    [ ... ]
>      The precedence and associativity of operands is fully specified, but
>    the order of evaluation of expressions is, with certain exceptions,
>        ^^^^^^^^^^^^^^^^^^^
>    undefined, even if the subexpressions involve side effects. That is,
>    unless the definition of an operator guarantees that its operands are
>    evaluated in a particular order, the implementation is free to evaluate
>    operands in any order, or even to interleave their evaluation. [ ... ]
>         This rule revokes the previous freedom to reorder expressions with
>         operators that are mathematically commutative and associative, but
>         can fail to be computationally associative. [ ... ]
> 
> So the compiler seems to be allowed to evaluate
> 
> a * ( b * c )     instead of   a * b * c
> 
> but not
> 
> a * ( b / c )     instead of   a * b / c
> 
> Is this correct?
> 

No. The point to remember is that precedence/associativity are NOT the
same thing as order of evaluation.  The expression "a * b * c" is required
to be treated like "(a * b) * c", that is, "a" and "b" are multiplied together
and the result is multiplied by "c"; that's the associativity rule.  As it
says above, "the precedence and associativity of operands is fully specified".
In other words, the parsing of the expression (what operands go with what
operators) is precisely defined:  the operands of the rightmost "*" in this
example are "a*b" and "c".  What's undefined is the order of evaluation -- 
the subexpressions "a", "b" and "c" are not required to be evaluated in any
particular order.

The only time order of evaluation matters (indeed, the only time you can
even _tell_ what order is being used, without resorting to looking at
object code) is when the subexpressions have side effects.  For example,
in "a() * b() * c()" there's no telling what order the functions may be
called in.  This is fine if the functions have no side effects, but if
they do (for example, if they print the function name on the terminal
when called) the results are undefined.
Organization: Ryerson Polytechnical Institute
Distribution: na
Date: Monday, 2 Nov 1992 20:08:13 EST
From: <ACPS7188@RyeVm.Ryerson.Ca>
Newsgroups: comp.lang.c
Subject: Looking for software to run C in P.C

  Hello all!
 I'm looking for someone who has a software of C for sale or someone who
doesn't want to sale it, but is kind to copy it for me.  I'll send the
diskettes to you if you feel that you can copy it.  In the case that you
want to sale it, please let me know the price.  I'm asking all of you here
because it's too expensive for me to get a brand new software.
 My P.C is 100% IBM compatible, and I'm really not sure how many MBytes I
have to have in my RAM in order to run this software. If you know it, please
also tell me.
  I really appreciate any help or any information from anyone.
  Please mail for me at ACPS71888@RyeVm.RYERSON.CA or you can just reply
this article in NetNews, I'm gona check it as often as possible.
  Thanx in advance!
From: sakamoto@sm.sony.co.jp (Tomohiko Sakamoto)
Newsgroups: comp.lang.c
Subject: Re: How to print an integer as binary?
Date: 5 Nov 92 07:49:40 GMT
Reply-To: sakamoto@sm.sony.co.jp
Organization: Workstation Div., Supermicro Systems Group, Sony Corporation

In article <1992Nov4.180622.6568@csd.uwe.ac.uk>,
        th2_oate@csd.uwe.ac.uk (Tom Oates) says:
> Assuming that:- 
> int i = 203;
> How do I display 'i' as 11001011?

I hope this help you.

putb(i)
	unsigned i;
{
	if (i > 1)
		putb(i >> 1);
	putchar(i & 1 | '0');
}

--
T. Sakamoto
From: pcastine@tubkom.prz.tu-berlin.de (Peter Castine)
Newsgroups: comp.lang.c
Subject: Re: The Correct Way To Write C if-Statements
Date: 13 Nov 92 15:17:15 GMT
Organization: TU-Berlin TUBKOM, Germany

In article <1992Nov12.212728.8864@dg-rtp.dg.com> goudreau@batman.rtp.dg.com (Bob Goudreau) writes:
<<whole bunch of stuff deleted>>
>
>Anway, if I were posting in Swedish, then perhaps I'd put only one
>space after each period.  But in English, two following spaces *IS*
>the standard (look it up).

You mean American English. Contemporary British English is different.


================================================================================
 Peter Castine                            |
 Technische Universitaet Berlin           |  "Errors and anachronisms ought to
 Sekretariat H51                          |   be few. If they do occur, I take
 Fachgebiet Kommunikationswissenschaften  |   full responsibility like Richard
 Strasse des 17. Juni 135                 |   Nixon..."
 W-1000 Berlin 12                         |                     -- Gore Vidal
 Germany                                  | 
================================================================================

-- 
================================================================================
 Peter Castine                            |
 Technische Universitaet Berlin           |  "Errors and anachronisms ought to
 Sekretariat H51                          |   be few. If they do occur, I take
Newsgroups: comp.lang.c
From: dfuller@portal.hq.videocart.com (Dave Fuller)
Subject: last of TRUE & FALSE
Organization: VideOcart Inc.
X-Newsreader: Tin 1.1 PL3
Date: Thu, 12 Nov 1992 05:09:51 GMT

This will be the end of my mail on TRUE & FALSE -> C_SUCCESS & C_FAILURE

I noted that i didn't use them for logical tests that c handled on its own.
what i would use it for though is a routine that was getting a defined
valid key constantly (say get_key() tested for presses of A,C,D,E or T)
and i wanted to continue fetching until the user hit a key that didn't 
fall into the group I would do.

while (get_key() == C_SUCCESS)
{
  total_key_presses ++;
}
printf("Hit A,C,D,E, or T %d times\n", total_key_presses);

in this manner all of my functions dont use a hardcoded value to test
against.

Dave Fuller
dfuller@portal.hq.videocart.com

Newsgroups: comp.lang.c,comp.lang.c++
From: yhtao@magnus.acs.ohio-state.edu (Yu-Hui Tao)
Subject: Converting an int or a float into a string*???
Organization: The Ohio State University
Date: Fri, 13 Nov 1992 13:50:58 GMT

Hi, netters:

   I have an array of numerical numbers of type either int or float. 
What I want is to convert this array into of type char*. For example, 
converting num[0]=1.02 into num[0]="1.02".   

   How do I do this in C and C++? Hope this is not too trival!


   Thanks!

Yu-Hui Tao
ISE, OSU
tao@CSEL.eng.ohio-state.edu
===========================
Newsgroups: comp.lang.c
From: ps@cs.strath.ac.uk (Paul Shaw)
Newsgroups: comp.lang.c
Subject: Re: To Recurse or NOT to recurse?
Date: 12 Nov 92 09:24:24 GMT
Organization: Comp. Sci. Dept., Strathclyde Univ., Glasgow, Scotland.

In article <BxKAJ2.7H@netnews.jhuapl.edu> bandy@netnews.jhuapl.edu (Mike Bandy) writes:
>
>I've used C on a few platforms and have never seen an optimization that
>converts recursion to anything but an optimized recursion.  What you're 
>saying is that the optimizer will replace user-defined function calls
>with in-line code.  Can someone give an example of a compiler (and perhaps 
>some code) that verifies this?
>
>AI-101 class often has an assignment that takes a LISP procedure as input,
>determines that it does tail-recursion, converts it into a looping procedure,
>then calls it.  Given that LISP functions look exactly like LISP data, 
>it's not a big deal -- not the case in C.
>

Well, here we are.  This was done on a Sparc station with the -O2 option of cc.

Simple recursive program...

typedef struct LIST {
   int i;
   struct LIST *next;
}LIST;

void rec(l) LIST *l;
{
   if (l) {
      printf("%d",l->i);
      rec(l->next);
   }
}

and this is the non-recursive assembly code generated (6 instruction in the
loop)

	.seg	"text"			! [internal]
	.proc	16
	.align	4
	.global	_rec
_rec:
!#PROLOGUE# 0
!#PROLOGUE# 1
	save	%sp,-96,%sp
	sethi	%hi(L19),%o0
	tst	%i0
	be	LE12
	add	%o0,%lo(L19),%i5
	ld	[%i0],%o1
LY2:					! [internal]
	call	_printf,2
	mov	%i5,%o0
	ld	[%i0+4],%i0
	tst	%i0
	bne,a	LY2
	ld	[%i0],%o1
LE12:
	ret
	restore
	.seg	"data"			! [internal]
	.seg	"data1"			! [internal]
L19:
	.ascii	"%d\0"

Incidentally, the iterative version:

while(l) {
   printf("%d",l->i);
   l = l->next;
}

produces identical code.

Paul Shaw,
Dept of Computer Science,
University of Strathclyde,
Glasgow.
Newsgroups: comp.lang.c,comp.software-eng
From: mjs@hubcap.clemson.edu (M. J. Saltzman)
Subject: Re: Will we keep ignoring this productivity issue?
Organization: Clemson University, Clemson SC
Date: Fri, 13 Nov 1992 16:27:54 GMT

In article <BxMuBK.ArM@inews.Intel.COM> nsridharan@faois.intel.com (Sridharan) writes:
>
>Try a hypothesis:  What if .. just what if .. the famous 80-20 rules works.
>Examples: 80 percent of the function comes from 20 percent of the code
>	80 percent of the value comes from 20 percent of the effort
>	80 percent of the result comes from 20 percent of the people (in a large
>project)
>	and etc etc
>[...]
>
>Comments?

Well for every aphorism, there is an equal and opposite counter-aphorism. 8^)
I'm thinking of the famous 90-90 rule:

	The first 90 percent of the project takes 90 percent of the time,
	and the last 10 percent of the project takes the other 90 percent
	of the time.



-- 
		Matthew Saltzman
		Clemson University Math Sciences
		mjs@clemson.edu
From: slahiri@jade.tufts.edu (Count Dracula)
Newsgroups: comp.lang.c
Subject: Re: Oject Oriented C libraries
Date: 12 Nov 92 03:53:53 GMT
Organization: Tufts University - Medford, MA

In article <7885@charon.cwi.nl> kwakkel@cwi.nl (Fred Kwakkel) writes:
>Hai,
>
>I'm looking for some object oriented C likr libraries (not C++!).
>I want to do set manipulation with arbitrary data structures,
>symbol table manipulation and more of these these 'low-level' 
>abstract data types. If you know an ftp site where I can find these libraries
>(pure C, not compiled), please mail them to me.

Hey, hey to me too, please .

-Sandip
Newsgroups: comp.lang.c
From: jasons@atlastele.com (Jason Smith)
Subject: Re: Memory functions  -  memcpy & memmove
Organization: Atlas Telecom Inc.
Date: Tue, 10 Nov 1992 16:22:11 GMT

In article (The name isn't important) writes:

[ Rant deleted ]

>by some other programmer, then we have a problem. BUT, guess what.
>I wrote this, not another programmer. and it works. and if someone
>else breaks it by changing a definition without seeing the effects
>it has, then GOOD.
>

Heaven help the programmers who inherit his code...

-- 
_______________________________________________________________________________
Jason D. Smith  | Atlas Telecom | There are two kinds of opinions.  There
                | Portland, OR  | are good ones, and then there are other
     1x1        | 503-228-1400  | peoples'.  These are mine alone... JDS
Newsgroups: comp.lang.c