HDTenEightyP/NetNews huggingface dataset:
From: dwb@IMD.Sterling.COM (David Boyd)
Subject: Re: sun cc optimization failure
Reply-To: dwb@IMD.Sterling.COM
Organization: Sterling Software
Date: Fri, 4 Sep 1992 15:32:13 GMT
X-Md4-Signature: f8fbb2d01c742019f72f66c0f47ba434

In article <KHB.92Sep3101751@chiba.Eng.Sun.COM>, khb@chiba.Eng.Sun.COM (Keith
Bierman fpgroup) writes:
|> 
|> >...code elided
|> >... misc questions and comments...
|> >...Sun out there listening?  Does Sun even care given that they are
|> unbundling
|> 
|> The problem was fixed in the unbundled compiler released quite a while
                                ^^^^^^^^^
|> ago.
	< Many compiler tests are deleted>
|> The authors of the compiler are always interested in improving it.
|> Please report problems (including release number of the compiler) when
|> they are found.

	I will first apologize to the SUN compiler people for questioning
their concern about their product.  The response shows that they find and
fix problems reported.  Unfortunately in this case the cure (buying the
unbundled compiler at $$$$*<number of programmers)), is more painfull than
the illness.  My main dig was at the unbundling, not the maintainers.  If 
the unbundling was not going to occure then I would have expected either a
patch or a fix in the next OS release.  From the response I can surmise that
neither of these will occur. (Please correct me if I am wrong).  Without
re-starting the war on unbundling again I was trying to point out that SUN
probably doesn't understand the full impact of that decision of a number
of its customers.  I won't waste anymore bandwidth on this since the deed is
done and we all need to figure out how to live with it.

-- 
David W. Boyd	             UUCP:     uunet!sparky!dwb
Sterling Software IMD        INTERNET: dwb@IMD.Sterling.COM
1404 Ft. Crook Rd. South     Phone:    (402) 291-8300 
Bellevue, NE. 68005-2969     FAX:      (402) 291-4362
From: tp718390@longs.LANCE.ColoState.EDU (Thomas Proell)
Newsgroups: comp.lang.c
Subject: Re: random number generation
Date: 28 Aug 92 20:59:15 GMT
Reply-To: tp718390@longs.LANCE.ColoState.EDU (Thomas Proell)
Organization: Engineering College, Colorado State University

In article <1992Aug27.133805.21292@u.washington.edu>,
scipio@milton.u.washington.edu (jim lee) writes:
> Can someone help me?  I need some coding that will generate random
> numbers.
> 
> Thanks for any help.
> 
> 
> Jim Lee (scipio@u.washington.edu)

A very elegant way to generate many different streams of uniformly
distributed pseudo-random numbers is to use the ?rand48() library.
The ? stands for either one of the following letters [d, e, l, n,
m, j]. This assumes that you have access to a good C-compiler. 

drand48(), lrand48(), and mrand48() require to be initialized, i.e.
srand48(time(NULL)); and are called without an argument. 

erand48(x sub i), nrand48(x sub i), and jrand48(x sub i) do not need
to be initialized. x stands for an >unsigned short< integer array. Using
different arrays as arguments for calling the subroutine gives you the 
ability to generate different streams of i.e. floating point values; i.e: 

main(int argc, char **argv)
{
 
  unsigned short *x, *y, ....

  float          *a, *b, ....

  x = calloc(MAX, sizeof(unsigned short)); 
  y = .......
  a = calloc(MAX, sizeof(float)); 
  .....

/* Seed the first element. All subsequent values are generated 
   by the function.                                               */

  x[0] = 0; 
  y[0] = 10; 

  START LOOP
      a[loop] = (float) nrand48(x); 
      b[loop] = (float) nrand48(y); 
  .
  .

lrand48() and nrand48() gives a non-negative long integer in [0.0....2^31)
mrand48() and jrand48() gives signed long integer in [-2^31....2^31]
drand48() and erand48() gives a non-negative double precision in [0.0...1.0]
{Had troubles with the last one!}


Hope I could help, 
Thomas Proell
Department of Chemical Engineering
Colorado State University
Fort Collins, CO 80525  
Newsgroups: comp.lang.c
From: kui@mff.uniba.cs (Katedra u.inteligencie)
Subject: Zortech Ctrl-C & Ctrl-Break
Organization: Faculty of Maths & Physics, Comenius University, Bratislava, Czechoslovakia
X-Newsreader: Tin 1.1 PL4
Date: Thu, 3 Sep 1992 14:35:18 GMT


Hello world,

I have two Zortech-C questions:
1) Does anybody know about Zortech-C Debugger running in protected
   mode 386 with Zortech 3.0 extender ?
   How can I debug C-program compiled with ZTC 3.0 running in protected
   mode 386 ?
2) I do not know how to handle with Ctrl-C and Ctrl-Break
   interrupts in Zortech application running with ZTC extender in
   386 protected mode.

                            Thanx 
				Boro

E-mail: kui@mff.uniba.cs
From: cflatter@nrao.edu (Chris Flatters)
Newsgroups: comp.lang.c
Subject: Re: C vs. FORTRAN
Date: 3 Sep 92 22:51:36 GMT
Reply-To: cflatter@nrao.edu
Organization: NRAO

In article 92Sep3164036@spsd630a.erim.org, dwiseman@spsd630a.erim.org (Dave Wiseman) writes:
>
>Help!
>
>I have a (two) simple programs, one in fortran, and one in C.  I have compiled
>them both optimized, and timed the results.  The fortran version takes .1 s
>to run, and the C version takes 12.5s to run.  I know (hope) that there is a
>simple remedy for this.  The project that I am working on has to do many 
>sines and cosines, and I'd prefer to keep the entire program in C, and not
>mix the languages.  What can I do to improve the speed of the C version?
>
>	Dave Wiseman
>	dwiseman@erim.org
>
>-------------------------------------------------------------------------------
>#include <stdio.h>
>#include <math.h>
>
>main (argc,argv)
>     int argc;
>     char **argv;
>{
>  double angle,delta,the_sin,the_cos;
>  int i;
>  
>  angle = 0.0;
>  delta = 0.01;
>  
>  for (i=0; i<1000000; i++)
>  {
>    the_sin = sin(angle);
>    the_cos = cos(angle);
>    angle += delta; 
>  }
>}
>-------------------------------------------------------------------------------
>      program test
>
>      real*8 angle,delta,the_sin,the_cos
>      integer*4 i
>
>      angle = 0.0
>      delta = 0.01
>
>      do I=1,1000000
>         the_sin = dsin(angle)
>         the_cos = dcos(angle)
>         angle = angle + delta
>      enddo
>
>      end

Beware of timing trivial programs.  Since the first 999 999 values of the_sin
and the_cos are discarded an optimised is at liberty to avoid computing them.
It is likely that the FORTRAN compiler did this and while the C compiler
did not.  I am fairly sure that if the_sin and the_cos were made into arrays
and if the sin and cos results were stored into the_sin(i) and the_cos(i)
on every loop the C and FORTRAN versions would take almost exactly the
same time to run.

The only other likely possibility is that the FORTRAN compiler is exploiting
a hardware implementation of the transcendental functions while the C compiler
is not.  This is only a significant possibility on Intel 80x86/80x87 machines
and since the 0.1 second time for the FORTRAN implies a floating-point
performance in excess of 30 MFLOPS it is a very remote one.

	Chris Flatters
	cflatter@nrao.edu
From: kjb@cgl.citri.edu.au (Kendall Bennett)
Newsgroups: comp.lang.c
Subject: Re: String hashing algorithms
Date: 26 Aug 92 02:23:19 GMT
Organization: RMIT Advanced Computer Graphics Centre, CITRI, Melbourne

bsullivn@sc.sni.ie (Bryan O'Sullivan) writes:

>wolf@hubcap.clemson.edu (Randy Martin) writes:
>: Does anyone have any string hashing algorithms that are very fast and
>: produce few collisions?  

>I don't have any source to hand, but Peter Weinberger's hashpjw
>algorithm seems to produce consistently good results and few collisions.
>A listing can be found in K&R2 or the 1985 edition of the Dragon book
>(Aho, Sethi, and Ullman).

An implementation is available in my 'ctools' archive. It can be ftp'ed from
most places (garbo, simtel-20), or directly from:

	godzilla.cgl.rmit.oz.au

as the file:

	~ftp/kjb/ctools10.tar.Z

+------------------------------------------+-------------------------------+
| Kendall Bennett,                         | Internet:                     |
| Advanced Computer Graphics Centre,       | kjb@citri.edu.au              |
| Royal Melbourne Institute of Technology, | rcskb@minyos.xx.rmit.oz.au    |
| Victoria, AUSTRALIA.                     |                               | 
+------------------------------------------+-------------------------------+
| CoSysop (Bossman), PC Connection Australia:               +61 3 688 0909 |
+--------------------------------------------------------------------------+
From: chuckb@milton.u.washington.edu (Chuck Bass)
Newsgroups: comp.lang.c
Subject: Re: Most difficult part of learning C?
Date: 28 Aug 92 05:44:50 GMT
Organization: University of Washington

One source of confusion that I had was the preprocessor.  Not
with macros or defines but having multiple declarations of
variables, typedefs, structures when files were included more
than once for some reason.  This of course leads to
understanding whe the following is at the top of many headers:

#ifndef _THIS_HEADER_DEFINED
#define _THIS_HEADER_DEFINED
;
;your header stuff goes here
;
;
#endif

I pulled a few hairs catching this little problem.


Chuck Bass
College of Forest-Systems Engineering
University of Washington
chuckb@u.washington.edu
Newsgroups: comp.lang.c
From: jlg@cochiti.lanl.gov (Jim Giles)
Subject: Re: Giles' Manual Mania (Was - Re: About the 'F' in RTFM)
Organization: Los Alamos National Laboratory
Date: Tue, 1 Sep 1992 23:30:50 GMT

In article <1992Sep1.185546.15682@mksol.dseg.ti.com>, mccall@mksol.dseg.ti.com (fred j mccall 575-3539) writes:
|> [...]
|> No, Jim, my intent was to suggest that if you found UNIX so bad
|> because it was complex that you should seek something MUCH simpler.  I
|> think you better leave interpreting my intent to me; you're lousy at
|> it.

Finally you've said something right.  I found UNIX to be unnecessarily
complex.  I understood it (finally, after much effort), but I find it
difficult to recommend such unnecessary pain to other users - since it
was among the least powerful and hardest to use systems I've ever used.  
And there  *are* simpler things with *more* power already available.  
The only thing I have to seek are ways to attract users toward these 
better system designs.  Too many of these new designs and ideas are
let fall by the wayside because thay are not widespread standards.
And the pro-UNIX propaganda machine is a formidable opponent.  A
demonstration of the well known phenomenon in software design that
quality and popularity are uncorrelated.

-- 
J. Giles
Newsgroups: comp.lang.c
From: chans@marsh.cs.curtin.edu.au (Sean Chan)
Subject: Copying file of int to 2-d array
Organization: Curtin University of Technology
Date: Sun, 30 Aug 1992 07:55:29 GMT

Gidday all,

I'm trying to read a file, containing integers into a 2-D array that has
been dynamically allocated. However, I think I'm doing it wrong. When I
print out my array to screen, the values differ...yes, I am a beginner
in C :)

Here my code :-

#include <stdio.h>
#include <stdlib.h>

main  ()
{
   int **array, counter, r, c;
   FILE *infile;

   infile = fopen ("elevatio", "r");       /* open file */

   /* allocate space for array */

   array = (int **) malloc (98 * sizeof (int *));
   for (counter = 0; counter < 98; ++counter);
       array = (int *) malloc (98 * sizeof (int *));

   /* read each integer from file into array */

   for (r = 0; r < 98; ++r)
   {
       for (c = 0; c < 98; ++c)
       {
           fscanf (infile, "%d", &array[r][c]);
       }
   }
  
   /* check if values read are correct */

   for (r = 0; r < 98; ++r)
   {
       for (c = 0; c < 98; ++c)
       {
           printf ("%d ", array[r][c]);
       }
   }
   fclose (infile);
}

/* End of code */

I like to add that this code seems to work perfectly fine ALL THE TIME
on UNIX, but works at random on BORLAND C++ Ver 2.0

Thank you in advance.

Sean
***********************************************************************
*			                 *                            *
* Sean Chan		                 *   Inside every microchip   *
* Student Number : 892561F	         *   there is a little man    *
* 3rd Yr. Computer Science	         *   running around doing     *
* Curtin University of Technology        *   everything you have      *
*                                        *   asked him to do...       *
* E-Mail : chans@marsh.cs.curtin.edu.au	 *                            *
*          pchans@cc.curtin.edu.au	 ******************************
*				         *
******************************************
From: eht@coos.dartmouth.edu (Edward H. Truex)
Newsgroups: comp.lang.c
Subject: printf question
Date: 27 Aug 92 14:34:34 GMT
Organization: Dartmouth College, Hanover, NH

Hi all, 

I am trying to format a hexadecimal number whose width 
is always a constant - like 

	printf("%04x\n", address );

The problem comes in trying to use a #define'd macro to replace 
the '4' in the above format string.  What I have done is

#define ADDR_BITS 16

... blah blah ...

main( int argc, char *argv[] ){

... blah blah ...

sprintf( format_string, "%%0%dx\n", ADDR_BITS/4 );
printf( format_string, address );

... blah blah ...

exit(0);
}

I would like to get rid of the sprintf statement (and the corresponding 
format_string).  Is there a way to force a macro substitution into the
printf format??


Thanks,
Tad
Newsgroups: comp.lang.c,comp.std.c
From: bill@twwells.com (T. William Wells)
Subject: Re: strcpy implementation question
Organization: None, Mt. Laurel, NJ
Date: Wed, 26 Aug 1992 00:46:11 GMT

In article <PINKAS.92Aug24183511@caraway.intel.com> pinkas@caraway.intel.com (Israel Pinkas) writes:
: That's the problem.  I claim that copying past the end of the string is
: wrong, as the user may be building a string up backwards.  The compiler
: writers claim that there is nothing in the ANSI spec that claims that the
: memory past the destination's terminator is inviolate.

The compiler writers are out to lunch. When the standard says
function X does Y, unless there is something to the contrary in
the standard, then Y is all that X does. Strcpy copies a string.
That's ALL it copies. If it copies anything else, it is doing
something other than what the standard says it is to do. A string
does not include characters past the terminating nul, therefore
copying anything past the nul IS AN ERROR.

---
Bill                            { uunet | decwrl | telesci }!twwells!bill
bill@twwells.com
Newsgroups: comp.lang.c,news.answers
From: jwarner@mrcnext.cso.uiuc.edu (Jack E. Warner)
Subject: help me get started in C
Organization: University of Illinois at Urbana
Date: Thu, 27 Aug 1992 00:47:31 GMT

Thanks in advance to anyone answering my queries. I have received guidance
from other newsgroups when learning a new language and it helps tremendously.
The C class is full so I'm going to read the books and try to keep up with
it anyway. I would like to learn how to do ``simple'' tasks in C like: 

****************************************************************************

   1.  make sure a file has only 1 space after words and punctuation, and
       no space after carriage returns (\015), i.e., the beginning of a line.
       invocation: "spaces <filename>" 

/* spaces.c */
#include <stdio.h>
int main(argc, argv, arge)
{
int argc;
char *argv[];
char *arge[];

/* this is the file to be opened for correciton */
FILE *fp
FILE *fopen(char *name, char * mode);

/* needs to open file argv[1], argv[2] (if present), etc. and replace more
than one space with only one; also needs to make sure a space never begins
a line. */
maybe using fgets();

}

****************************************************************************

   2.  inspired by a recent database programming contract job, a C utility
       to print the number of characters per paragraph (\015) and the number
       of paragraphs, such that the output looks something like:
       
            	line number 001 contains 192 characters
                line number 002 contains 192 characters
                line number 003 contains 191 characters
                ...
                line number 999 contains 192 characters

       invocation: "count <filename>"

/* count.c */
#include <stdio.h>
int main(argc, argv, arge)
{
int argc;
char *argv[];
char *arge[];

/* this is the input file */
FILE *fp
FILE *fopen(char *name, char * mode);

/* need to open output file --- HELP!! */
strlen( )

}

****************************************************************************

Though I prefer working in UNIX environments, sometimes the jobs are in the
DOS world so I would like make-my-life-easier utilities to be portable if
possible. In other words, I could use "sed" or something like "tr" to
acomplish these tasks but (whining...) I wanna do it in portable C.

Sincere thanks ...

jwarner@mrcnext.cso.uiuc.edu (Jack E. Warner)
From: linden@positive.Eng.Sun.COM (Peter van der Linden)
Newsgroups: comp.lang.c
Subject: Re: Convert COBOL COMP-3 to double?
Date: 27 Aug 1992 16:46:45 GMT
Organization: Sun Microsystems, Mt. View, Ca.
NNTP-Posting-Host: positive

From: jack@afs.com (Jack Brasch)
> Could someone point me in the right direction or mail me a routine to  
> convert COBOL COMP-3 types to a double.

The COMP-3 format is implementation defined, but in most implementations
it is some form of binary-coded decimal (BCD) in which 2 digits are
stored in each byte (1 per nibble).  There's some jiggery-pokery for the
sign.

I would suggest converting it to an int or long first, then floating it,
then adjusting for the implied decimal point.  COBOL can hold up to 18
digits of precision in its fixed-point formats, so you may lose accuracy
when you hold the number as a double.

    Peter
--
linden@eng.sun.com|| P. van der Linden and his uncustomary theories.
Go Giants!! Don't || When solving a "panic" you must first ask yourself what you
stop at Florida...|| were doing that could possibly frighten an operating system
Newsgroups: comp.lang.c
From: vinod@dolomite.WPI.EDU (Vinod K Nair)
Subject: SEX SEX SEX
Organization: Worcester Polytechnic Institute
Date: Fri, 4 Sep 1992 16:02:51 GMT

Hi All !!
	Sorry no sex, that was just to catch your attn. My last mail
was completely ignored see... Anyway my question is for people with
HPUX systems. I have accidentally deleted (well overwritten) my
/usr/include/*.h  C header files with C++ header files and would really
really appreciate it if you would be kind enough to send me a copy of
the files (in an manner you choose)
	Thank you very much.
p.s: You shouldn't be so gullible
-- 
Vinod
email : vinod@wpi.wpi.edu
From: barmar@think.com (Barry Margolin)
Newsgroups: comp.lang.c
Subject: Re: Why should POINTERS be so damn hard to understand ?
Date: 28 Aug 1992 15:03:03 GMT
Organization: Thinking Machines Corporation, Cambridge MA, USA
NNTP-Posting-Host: telecaster.think.com

In article <1992Aug27.181844.11739@email.tuwien.ac.at> hp@vmars.tuwien.ac.at (Peter Holzer) writes:
>barmar@think.com (Barry Margolin) writes:
>>for (_i=(char *)a; _i<a+1000*sizeof(int); _i+=sizeof(int))
>>    *(int *)_i = whatever();
>>I would epect this to produce almost identical code.  And in a language
>>where pointers weren't typed, you wouldn't need all the casting.
>You would still have to cast _i to (int *), or the compiler couldn't
>know how much memory it should access (1 byte? 1 word? ...)

Declaring pointers doesn't allocate memory.

>Anyway, why should I type sizeof(int), when the compiler can do it for
>me?

Several people seem to have misunderstood the point of my posting.  I'm not
recommending the above code.  I was just showing how you would do it if C
didn't have this feature.  I was responding to a post that said that typed
pointers are *necessary* to be able to step a pointer through an array.

-- 
Barry Margolin
System Manager, Thinking Machines Corp.

barmar@think.com          {uunet,harvard}!think!barmar
From: Richard.Pillay@f5.n7103.z5.fidonet.org (Richard Pillay)
Newsgroups: comp.lang.c
Subject: QUESTION ABOUT CODE IN KE
Date: Sun, 30 Aug 92 12:00:00 GMT
Organization: FidoNet node 5:7103/5 - The Chatterbox, Durban

>do not appear to work, when I run them it takes in the input fine but d
>print anything out. As I am new to c I thought one of you net guru's co
>help me out:
>
>
 
It checks out fine here. Works great with no changes under BC++. Gives 1
warning, but no errors.
 
One thing that comes to mind: I'm sure you know this already, but I
thought I would mention it - the while loop won't exit until you type
an EOF which is Ctrl-Z.
 
Richard.


--  
INTERNET: Richard.Pillay@f5.n7103.z5.fidonet.org
via:  THE CATALYST BBS in Port Elizabeth, South Africa.
       (catpe.alt.za)   +27-41-34-1122 HST or +27-41-34-2859, V32bis & HST.
Newsgroups: comp.lang.c
From: Ross Ridge <ross@zooid.guild.org>
Subject: Re: Giles' Manual Mania (Was - Re: About the 'F' in RTFM)
Organization: ZOOiD BBS
Date: Wed, 26 Aug 1992 23:12:51 GMT

mccall@mksol.dseg.ti.com (fred j mccall 575-3539) writes:
> Find another job, Jim.  One that lets you use something nice and
> simple like MS-DOS.

jlg@cochiti.lanl.gov (Jim Giles) writes:
>This is an example of UNIX-speak.  This comment is frequently encountered,
>though the proposed alternative varies.  The implication intended is that
>the only alternatives to UNIX are single-user systems like MS/DOS, or are
>old-line systems of the same obsolete 20 year old vintage of UNIX like
>DEC/VMS.  Even if these *were* the *only* alternatives, that would only
>mean that there was an intense need for OS research.  But, these are not
>the only alternatives.

In terms of finding a job providing user support for, they, UNIX, MS/DOS,
and other single user and/or obsolete OS'es, are pretty much are the only
alternatives.

You seem to have an axe to grind.  Just what OS suits your fancy?

							Ross Ridge

-- 
Ross Ridge - The Great HTMU					     l/	 //
								    [OO][oo]
ross@zooid.guild.org						    /()\/()/
uunet.ca!zooid!ross						     db	 //
From: 6500mack@ucsbuxa.ucsb.edu (Michael P. Mack)
Newsgroups: comp.lang.c
Subject: How is NaN recognized?  (solved)
Date: 1 Sep 92 02:05:08 GMT

Thanks for all the responses.

The simplest solution to this problem was suggested by
Larry Jones of SDRC (lawrence.jones@sdrc.com)

By checking the return value of scanf(), it is easy to
tell when it has failed:

	if (scanf("%f",&value) == EOF)
	  value = 0.0;


Mike
From: jos@and.nl (Jos Horsmeier)
Newsgroups: comp.lang.c
Subject: string concatenation (was: Re: printf question)
Date: 2 Sep 92 12:48:47 GMT
Organization: AND Software BV Rotterdam

In article <1SEP199221241770@eql.caltech.edu> rankin@eql.caltech.edu (Pat Rankin) writes:
|In article <3361@dozo.and.nl>, jos@and.nl (Jos Horsmeier) writes...
|[ quoting other articles ]
|>||   #define HDPI "4" /* Hex Digits Per Int */
|>||	   printf( "%0" HDPI "x\n", address );
|[ text deleted ]
|> in this case, the pre-processor concatenates the constant strings after
|> macro replacement.
|
|     Minor quibble:  string concatentation is performed by the compiler,
|not the preprocessor.  Since this won't work with pre-ANSI compilers, its
|use tends to reduce portability anyway.

You're probably right, but let me tell my reasoning: I had to implement
my own preprocessor lately (for obscure reasons) and I looked up the
8 different translation phases in the standard. Phase 6 reads:

Adjacent character string literal tokens are concatenated and adjacent
wide string literal tokens are concatenated.

Phase 7 reads:

[ ... ] The resulting tokens are syntactically and semantically
analyzed and translated.

So, phase 7 is the phase where the grammar comes in. On of the first
grammar rules reads:

primary-expression:
	[ ... ]
	string-literal

Where string literal is defined as:

string-literal:
	"s-char sequence_opt"
	L"s-char sequence_opt"

See? A string literal is not defined as a concatenation of one or more
string literals. That's why I thought that the process of concatenating
these things was done in the preprocessor. Well, it does so in mine ...

Section 3.3.1 (Primary expressions) says nothing about a concatenation
of string literals either, so that made my believe that I was right
even stronger, but I've tried some other preprocessors just now and
none of them does the concatenation, so, again, you're probably right.

kind regards,

Jos aka jos@and.nl
Newsgroups: comp.lang.c