HDTenEightyP/NetNews huggingface dataset:
From: ssathyan@enuxha.eas.asu.edu (Seshadri Sathyanarayan)
Newsgroups: comp.lang.c
Subject: Re: VAX C function for char input
Date: 15 Apr 92 01:43:33 GMT
Reply-To: ssathyan@enuxha.eas.asu.edu (Seshadri Sathyanarayan)
Followup-To: comp.lang.c
Organization: Arizona State University, Tempe AZ


Hi,
     This is to thank all those who responded to my request for the
function on VAX. I was able to use the smg$routines to read a character
without the return key. 

     Thanks again.

Seshadri (ssathyan@enuxha.eas.asu.edu).
Newsgroups: comp.lang.c
From: aisma@owlnet.rice.edu (Ahmad Ismail)
Subject: EXPONENT
Organization: Rice University
Date: Thu, 9 Apr 1992 18:29:08 GMT

I am new to the C language. Can anybody tell me how to write the following
FORTRAN code in C:

       a=b**(1./d)

Thanks.


Newsgroups: comp.lang.c
From: hugh@slee06.srl.ford.com (Hugh Fader)
Subject: Prototype generator wanted.
Reply-To: hugh@slee01.srl.ford.com
Organization: Ford Motor Company Scientific Research Labs, Dearborn, MI
Date: Wed, 15 Apr 1992 16:20:56 GMT

The FAQ for this group mentions that various prototype generators
other than the protoize patch to gcc are available. However it doesn't
give any further details. Can anybody out there name names and places?

Thanks in advance.
--
Hugh Fader
hugh@slee01.srl.ford.com

Newsgroups: comp.lang.c
From: ilan@seas.gwu.edu (Ilan Berkner)
Subject: C, C++ (timesharing)
Organization: George Washington University
Date: Tue, 14 Apr 1992 20:57:22 GMT

Hi, I'm looking for a small source code package for either TURBO C or C++
which will simulate a multitasking system on a PC using timesharing.
Meaning, a number of processes can be attached to this routing which will
place them in memory and provide a certain time quantum for each one. 
(round robin scheduling)
The number of processes that need to be run is 7.
Does anyone have access to such code? or know of any good book which will 
have it?

thanks, 

ilan@sparko.gwu.edu
From: torek@horse.ee.lbl.gov (Chris Torek)
Newsgroups: comp.lang.c
Subject: Re: passing structure to a function
Date: 14 Apr 92 17:02:02 GMT
Article-I.D.: dog.22702
Reply-To: torek@horse.ee.lbl.gov (Chris Torek)
Organization: Lawrence Berkeley Laboratory, Berkeley
NNTP-Posting-Host: 128.3.112.15

In article <mcook.702998942@mrc.dev.cdx.mot.com>
mcook@mrc.dev.cdx.mot.com (Michael Cook) writes:
>What's the difference between call-by-reference and passing a pointer?

With by-reference, you mark a parameter variable as `special' and the
compiler does all the work.  With explicit pointers, you (a) alter the
type of the formal parameter; (b) explicitly follow the pointer
everywhere you want to talk to its target; and (c) explicitly take the
address of an existing object in all calls to the function.

In particular, in a C-like typed language that had call-by-reference,
if `typeof()' were a built-in function that returned a string unique
to the particular type:

	void foo(ref int array[10]) {
		putfmt(stdout, "%s\n", typeof(array));
	}

might print

	array 10 of int

In this same hypothetical language, passing the array by value you
would get:

	void foo(val int array[10]) {
		putfmt(stdout, "%s\n", typeof(array));
	}

and the same output, while passing a pointer to &array[0] would give
you:

	void foo(val int *p) {
		putfmt(stdout, "%s\n", typeof(p));
	}

	pointer to int

In C, all you get is by-value.  The hypothetical typeof() does not
exist, but if it did, you would find that even with

	void foo(int array[10])

the type would be `pointer to int'.  The code

	void foo(int array[10]) {
		int i;
		for (i = 0; i < 10; i++)
			*array++ = 0;
	}

is perfectly legal, despite appearances.

Note that this holds ONLY for formal parameters, and

	void bar(void) {
		int i, array[10];
		for (i = 0; i < 10; i++)
			*array++ = 0;
	}

is illegal.  This time, the type of `array' is `array 10 of int',
*not* `pointer to int'.
-- 
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 510 486 5427)
Berkeley, CA		Domain:	torek@ee.lbl.gov
Xref: sparky comp.lang.c:7531 comp.databases:4119
From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius)
Newsgroups: comp.lang.c,comp.databases
Subject: Re: What is a good special-value to use for "not available"?
Date: 13 Apr 92 15:27:10 GMT
Organization: University of Helsinki

ajayshah@alhena.usc.edu (Ajay Shah) writes:
>I often encounter text files of data, where a field takes the value "."
>to mean "not available".  When I read this into a in-core data structure,
>I'd like to give it some special value which (we hope) will not ordinarily
>occur in data.  What should that special value be?

>1. Maybe use special values like NaN for a IEEE float.

Unportable and ugly.  Requires knowledge of the floating point
representation.

>What do you suggest?  Maybe a bit pattern like 1010101?

Random patterns may cause trouble, if the math library (or coprocessor,
or something beyond your control) checks floating point values for
sanity.  I believe not all possible bit patterns are valid floating
point values.

Two ideas:

a) Use a separate flag.  I would personally prefer this if it doesn't
take too much space.

b) The macro HUGE_VAL is already used by <math.h> to represent
"infinity".

--
Lars.Wirzenius@helsinki.fi
Xref: sparky comp.lang.c:7257 comp.std.c:1752
From: abraham@iesd.auc.dk (Per Abrahamsen)
Newsgroups: comp.lang.c,comp.std.c
Subject: Re: PLEASE don't use "long long" for 64 bits + answer to letter
Date: 29 Mar 92 17:55:58 GMT
	<ksspmmINNkep@spim.mips.com> <1992Mar27.001149.9240@blilly.UUCP>
	<1992Mar27.212626.386@ux1.cso.uiuc.edu>
Organization: HUGIN Expert A/S


>>>>> On 27 Mar 92 21:26:26 GMT, mcdonald@aries.scs.uiuc.edu (Doug
>>>>> McDonald) said:

Doug> Will MIPS make, for their 64 bit machines, as standard, a compiler
Doug> where sizeof(char) == 1 , sizeof(short) == 2, sizeof(int) == 4 and
Doug> sizeof(long) == 8, with no "long long" type??

Doug> IF they do that nobody has any complaint with them if they do, indeed,
Doug> offer a switch to change sizeof(long) to 4 and add a "long long". I sure
Doug> don't. 

Will the C purists really accept a 32 bit int on a machine with a 64
bit natural word size?
From: wr@bara.oche.de (Wolfram Roesler)
Newsgroups: comp.lang.c
Subject: Implementor's Namespace? (Re: atexit_t)
Summary: What exactly is "implementor's namespace"?
Date: 7 Apr 92 19:54:42 GMT
Reply-To: urmel!tornado!bara!wr
Organization: Private UUCP site - Aachen, Germany

In <1992Apr4.103701.13420@klaava.Helsinki.FI>,
Lars Wirzenius (wirzeniu@klaava.Helsinki.FI) wrote:

[atexit_t]
> the name is not in the implementors namespace (i.e., the
> standard allows the user to use the name ``atexit_t'' as he wishes),

What exactly is the "implementor's namespace"? All names that begin
with an underscore, or with a double underscore?
I think that should make its way into the FAQ, something like "Why
shouldn't I use names that begin with an underscore".

CU
Wolfram
--
Wolfram Roesler            Augustastr. 44-46            W-5100 Aachen
(Usenet) wr@bara.oche.de  (Mausnetz) AC2  (Voicenet) +49(0)241 534596
From: ajayshah@alhena.usc.edu (Ajay Shah)
Newsgroups: comp.lang.c
Subject: Re: Random Numbers
Date: 15 Apr 1992 17:07:24 -0700
Organization: University of Southern California, Los Angeles, CA
NNTP-Posting-Host: alhena.usc.edu

#include <stdio.h>

/* This file implements the "minimal standard" RNG
   from the paper "RNGs: Good Ones are Hard to Find" by Park and
   Miller, CACM, Volume 31, Number 10, October 1988. */

static long int seed = 1;
/* static so programs will be more "orderly" in modifying the
   seed.  The setseed function is the prescribed way in which the seed
   is altered.  A good default to use is your SSN.
   Any seed from 1 to 2147483646 is equally ok. */

int setseed(long int newseed)
{
    if ((newseed < 1) || (newseed > 2147483646)) return 1;
    seed = newseed; return 0;
}

double ranpm()
     /* page 1195-right, "Integer Version 2", works iff ints are 32 bits.*/
{
    long int a=16807, m=2147483647, q=127773, r=2836;
    int lo, hi, test;

    hi = seed / q;
    lo = seed % q;
    test = a * lo - r * hi;
    seed = (test > 0) ? test : test + m;
    return (seed/ (double) m);
}

double ran1(int *newseed)  /* for compatibility */
{
    if (*newseed == 0) {
	fprintf(stderr, "Stop using ran1(); use ranpm() instead.\n");
	fprintf(stderr, "(Don't worry, ran1() still works.\n");
	fprintf(stderr, "ran1() will 'soon' be removed from libans.\n");
	*newseed = 1;
    }
    return ranpm();
}

#ifdef TESTING
/* They give us one test (on page 1195-left): if seed = 1 then
   the 10001'th random number should be 1043618065.
   Apart from this, I do some superficial testing aimed at checking
   the code above is not buggy.  I'm not trying to test the
   statistical properties of the RNG. */

int main()
{
    int n; double u, sum=0.0, sum2=0.0;
    
    for (n=1; n<=10000; n++) {
	u = ranpm();
	if ((u < 0.0) || (u > 1.0)) {
	    printf("Garbage at the %dth number!\n");
	    return 1;
	}
	sum += u;
	sum2 += (u*u);
    }
    printf("The current value of seed is : %10d\n", seed);
    printf("The Truth is %17s 1043618065\n\n", " ");

    printf("Mean of 1st 10k nums is %f, variance is %f\n",
	   sum/10000, sum2/9999);
    printf("Expect .5018 and .3355\n");
    return 0;
}
#endif /* TESTING */
-- 

Ajay Shah, (213)749-8133, ajayshah@usc.edu
Newsgroups: comp.lang.c
From: steve@taumet.com (Steve Clamage)
Subject: Re: Is the address of a global a constant?
Organization: TauMetric Corporation
Date: Tue, 7 Apr 1992 19:02:13 GMT

chupchup@ferkel.ucsb.edu (Robert Earl) writes:

>eric@pencom.com writes:

>| Is the address of a global supposed to be considered a valid constant?

>No.  The address-of operator (&) is just an operator and does not
>yield a constant value.

The address of a static variable is a constant. For example, at file level:
	int i;
	int *ip = &i;	/* legal */

>| int foo(int *p)
>| {
>|         switch(p)
>| 	{
>| 		case &a :
>[ deleted... ]

>| gcc first complains that p is not an integer.
>| It then complains that the switch labels are not constant.
>| Are these valid compiler gripes?

>Yes.

The controlling expression of a switch must be an integer type, so
the first error message is correct.

The case labels must be integer constant expressions.  The second
error message is a little misleading if it only said "constant",
and correct if it said "integer constant".  The example case labels
are pointer constants.

You cannot portably use pointer values in a switch statement, since
even casting them to type long will not always work.
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
Vice Chair, ANSI C++ Committee, X3J16
Newsgroups: comp.lang.c
From: mcook@mrc.dev.cdx.mot.com (Michael Cook)
Subject: Re: using #define
Organization: Motorola Codex, Canton, Massachusetts
Date: Fri, 17 Apr 1992 16:13:32 GMT

eisenhof@zax.teraida.UUCP (Karl Eisenhofer) writes:

>In article <1992Apr13.212232.2709@acsu.buffalo.edu> v101q4ct@ubvmsb.cc.buffalo.edu (Brendon M McNamara) writes:
>>How can I do this:
>>
>>#define FILE(n)   "FILE.F"(somehow stick n in here)
>>
>>func() {
>>    int x;
>>    for (x=0;x<10;x++) printf("\n%s",FILE(x));
>>}
>>
>>to create the following output:
>>
>>FILE.F0
>...
>>FILE.F9

>ANSI C has a definite way to do this: the "stringize" operator.

>#define FILE(n) "FILE.F" #n

>The # character converts the symbol to a string and in ANSI C, two
>strings next to each other are concatenated by the compiler.

>(i.e. "this and " "that" is the same is "this and that")

>Non-ANSI C compilers may be implementation dependant, but the
>Sun C compiler will accept this notation:

>#define FILE(n) "FILE.F" "n"

These solutions have the same problem that some other
previously-posted solutions had.  This code:

  #define FILE(n) "FILE.F" #n
  func() {
      int x;
      for (x=0;x<10;x++) printf("\n%s",FILE(x));
  }

is equivalent to this code:

  func() {
      int x;
      for (x=0;x<10;x++) printf("\n%s","FILE.Fx");
  }

which, of course, has the following output:

  FILE.Fx
  FILE.Fx
  FILE.Fx
  FILE.Fx
  FILE.Fx
  FILE.Fx
  FILE.Fx
  FILE.Fx
  FILE.Fx
  FILE.Fx

The string construction happens at compile time.  There is no way to
generate a compile-time string from run-time value.

You can do something like this:

  #define FILEN "FILE.F%d"
  for (x=0;x<10;x++) printf("\n" FILEN, x);

Or this:

  char *filen[] =
  {
    "FILE.F0",
    "FILE.F1",
    /* ... */
    "FILE.F8",
    "FILE.F9",
  };
  #define FILE(n) filen[n]
  for (x=0;x<10;x++) printf("\n%s", FILE(x));
-- 
 ==========================================================
 Michael.Cook@merlin.dev.cdx.mot.com          (617)821-7590
 Motorola/Codex, 20 Cabot Blvd, C2-135, Mansfield, MA 02048
 ==========================================================
From: apyted@ubvmsb.cc.buffalo.edu (T. Steegman)
Newsgroups: comp.lang.c
Subject: c program for mapping algorithm?
Date: 15 Apr 92 04:10:00 GMT
Organization: University at Buffalo
News-Software: VAX/VMS VNEWS 1.41


	I'm still looking for a c program that emulates the Douglas Poiker
algorithm for line simplification. Any help would be GREATLY appreciated.
I'll even tell you some good jokes if you help me.  Thanks in advance.

Tom Steegmann
apyted@ubvmsb.cc.buffalo.edu
Organization: Queen's University at Kingston
Date: Monday, 13 Apr 1992 12:42:33 EDT
From: Harry Boumeester <BOUMEEST@QUCDN.QueensU.CA>
Newsgroups: comp.lang.c
Subject: Normally Distributed Variable Generator

I am looking for C code that will produce a normally distributed random variabl
e.  If anybody knows where source code exists or can send me it, it would be
much appreciated.
Newsgroups: comp.lang.c
From: kherron@ms.uky.edu (Kenneth Herron)
Subject: Re: forked processes become <defunct>
Followup-To: comp.unix.questions
Distribution: na
Date: Sat, 11 Apr 1992 02:22:06 GMT
Organization: University Of Kentucky, Dept. of Math Sciences
X-Bytes: 

>In article <1725@fnnews.fnal.gov> shah@fnalb.fnal.gov writes:
>>I am writing a program (server) which forks processes as needed, the problem
>>is that when a child process exits it becomes <defunct> until parent process
>>dies. 

>Have the parent do a wait(2) on the child at some point (after death), then
>the child will decompose politely.

[Followups directed to comp.unix.questions; this ain't a C question]

If you don't want to be bothered to wait() for your children (or do the
ill-documented, non-portable signal gymnastics needed so you can ignore 
them), reverse the parent/child roles.  After the fork(), have the parent 
service the request and exit, while the child waits for more requests.
-- 
Kenneth Herron                                       kherron@ms.uky.edu
University of Kentucky                                  +1 606 257 2975
Department of Mathematics
                                              Flame early, flame often.
From: alpha@wyvern.twuug.com (Joe Wright)
Newsgroups: comp.lang.c
Subject: Re: Is the address of a global a constant?
Date: 9 Apr 92 03:47:32 GMT
Organization: Tidewater UNIX Users Group

Aren't we getting bent around the wheel here.  There are 'constants'
and 'variables'.  A 'constant' is something that can be assigned by
the compiler and/or loader.  A 'variable' is something assigned at run
time.  The original question was about case arguments.  They must be
integral constants.  The argument to switch() must evaluate to something
the compiler can translate.  And it must be integral, a char, int, long.
Expressions may be used of course, but they must evaluate constant.

Stuff like &a - &b cannot work if a or b are not constant.

Again, if the compiler/loader can't figure it out, it is not 'constant'.
If it is not 'integral', you can't use it in a 'case' statement.

K&R1 should be prerequisite reading before even looking at ANSI.
-- 
Joe Wright  alpha@wyvern.twuug.com
Organization: University of Illinois at Chicago
Date: Friday, 10 Apr 1992 12:09:46 CDT
From: <U35284@uicvm.uic.edu>
Newsgroups: comp.lang.c
Subject: text mode display

hi i am writing a program with borland c 2.0 and i am having a little
difficulty creating a display. what i am trying to do is implement a
menu with a full screen blue background and white type. borland supplies
that i know of two user functions textcolor and textbackground that will
facilitate the manipilation of your display. howerver, i can not seem
to find a function that will allow for control of the entire background
screen. keeping in mind i am using the  text mode. i have searched through
the referece and cannot find anything. does anyone know of such a function
supplied with the compiler. if not some hints for writing my own. i do not
know much about graphics programming.

thanks in advance, all e-mail replies greatly appreciated.
Xref: sparky comp.lang.c:7491 comp.windows.ms.programmer:5353
From: beross@shelley.u.washington.edu (Ben Ross)
Newsgroups: comp.lang.c,comp.windows.ms.programmer
Subject: Re: Please.  (Was Re: I Hope the BC++ IDE Editor Supports OLE Soon)
Date: 11 Apr 92 19:39:49 GMT
Article-I.D.: u.1992Apr11.193949.7723
Organization: University of Washington, Seattle

In article <kuede7INN40h@alhena.usc.edu> ajayshah@alhena.usc.edu (Ajay Shah) writes:
>A good applications package may yearn for it's users spending 
>many an afternoon hitting buttons, but as a programmer I avoid
>such "user friendly" toys.
>
>User friendly -- you spend 15 minutes learning how to use it, and
>the rest of your life struggling to get your job done.

With all of your other points, I (more or less) agree.  On this point,
however, I feel the urge to take issue.  (Hey, I like being flamed as much
as anyone.  I might as well open myself up to it, right?)  For people
who use computers as much as programmers do, learning a new program (and
taking a long time to do it) is no big deal.  However, not everybody
understands computers as well as we do.  Most do not.  The people we write
programs do not (since they are using a "user-friendly" environment like
windows).  If you ask me, a better definition would be: 

User friendly -- A program that can be used productively after 15 minutes,
the more powerful features can be learned as they are needed, and allows
the user to circumvent the ease-of-use features for a quicker way.

I cite Aldus Pagemaker as a good example of this.  Any option can be accessed
through the menu, but there are enough short-cut keys that once you get
them memorized, you almost never have to see a menu.  The interface is 
intuitive and easy to learn quickly.    

The point is that user-friendly does not imply weak.  It is quite possible
to design a program that is both easy to use _AND_ powerful.  It does,    
however, require a lot more work.

Enjoy!
Ben Ross
(beross@u.washington.edu)

Disclaimer: I work for no one, so my opinions are probably worthless anyway.
If I reply to something you did not intend, please excuse me.  Feel free to
flame!
Newsgroups: comp.lang.c
From: ian@syacus.acus.oz.au (Ian Joyner)
Subject: C++ Critique in comp.lang.c++
Organization: ACUS Australian Centre for Unisys Software, Sydney
Date: Wed, 8 Apr 1992 11:57:09 GMT

I have placed a critique of C++ in comp.lang.c++ for those considering
the move from C to C++.
-- 
Ian Joyner                                     ACSNet: ian@syacus.acus.oz
ACUS (Australian Centre for Unisys Software)   Internet: ian@syacus.acus.oz.au
Tel 61-2-390 1328      Fax 61-2-390 1391       UUCP: ...uunet!munnari!syacus.oz
Newsgroups: comp.lang.c,comp.os.msdos.programmer,misc.wanted
From: dwight@rock.concert.net (Dwight Frye -- Systems Development Group)
Subject: Need -GOOD- 8051 C compiler
Organization: Little, if any...
Date: Mon, 13 Apr 1992 13:55:10 GMT

Newsgroups: comp.compilers,comp.lang.c,misc.wanted
Subject: Need -GOOD- 8051 C compiler ...
Summary: 
Followup-To: 
Distribution: world
Organization: Little, if any...
Keywords: question, C


[Being reposted .. did not look like it made it out. If you have already
seen this .. sorry.]

I am posting this for a friend. We are looking for a -GOOD- Intel 8051
C compiler. There have been a number of these available from a number
of different vendors but most have been rather poor in quality (from what
I have heard). If anyone has some experience with a 8051 C compiler that
they have been very happy with I would like to hear about it.

Basically .. I am looking for the -BEST- 8051 C compiler out there. The
code that is being ported compiles to about 60K on a 68000 so this will be
a fairly large piece of code for an 8051. The compiler will need to be
able to handle this size of code and the large number of symbols that will
come with it.

They also need the compiler system to run in an MSDOS environment.

I do not regularly read these newsgroups so if you have a response please
mail to me at "dwight@rock.concert.net".

Thanks ...
From: sunthej@alleg.edu (Jake)
Newsgroups: comp.lang.c
Subject: Selling my copy of The C Programing Language
Date: 9 Apr 92 02:47:28 GMT
Organization: Allegheny College

Hi!  

I have a copy of "The C Programing Language" (ala K&R C) in excellent  
condition that I'm willing to sell for $25 (about $15 less then what it  
costs new, last time I checked).  But, as with last time, I am posting  
this before I take off for an extended weekend in CMU (Carnival Weekend!).    
If interested, I could get back to you on Monday.

						Jake

sunthej@alleg.edu
Newsgroups: comp.lang.c
From: atbowler@thinkage.on.ca (Alan Bowler)
Subject: Re: Clearing the screen.
Organization: /etc/organization
Date: Fri, 10 Apr 1992 20:33:19 GMT

How to clear the screen is a function of the hardware of the screen,
not the operating system, or the C language.  There are some libraries
TERMCAP TERMINFO etc that allow you to specify the characteristics
of many terminals in one place, and then look up the correct method
at run time depending on the type of terminal (screen) being used.

Outputting a formfeed ("\f") works on many terminals, but it is not
universal.  There is a danger of hardwiring any particlar clear
screen sequence into your program.  This is illustrated by the Bull
7800 series terminals which use <esc>` as the clear screen sequence.
This happens to be the ANSI standard sequence for "lock keyboard".
It is very annyoying to run a program that just "knows" you will
be using a 7800, and find your keyboard locked the moment the
program starts because it wanted to clear the screen, and you happened
to be using an ANSI standard terminal instead.
Newsgroups: comp.lang.c
From: atbowler@thinkage.on.ca (Alan Bowler)
Subject: Re: const Questions
Keywords: const pointers declarations
Organization: /etc/organization
Date: Tue, 31 Mar 1992 01:57:22 GMT

In article <22346@dog.ee.lbl.gov> torek@horse.ee.lbl.gov (Chris Torek) writes:
>
>I recommend against this.  In fact, I recommend against using empty
>array brackets everywhere, and against array syntax in all formal
>parameter declarations (for reasons I seem to have to explain on
>comp.lang.c about once a week).

Thank you for having the patience to explain it anyway.  I wish I knew
why people feel they must declare array arguments as something other
than what the compiler will be passing just because the compiler will
"promote" the declaration to something else.  Even after many years of
C programming I still find it easier to remember that "p" is a pointer
if I find it declared as

    func(int *p)

then as
    func(int p[])

The latter just looks too much like

extern int p[]

where "p" is an array.

The rule of "declare what it there" applies especially to old style
argument declarations.

    func(a, b, c)
      float a; short b; char c; {

is really hard to read and remember that this needs to be prototyped
as 
    extern func(double, int, int)
when converting to prototypes, or to understand that the code is doing
when debugging.
Newsgroups: comp.lang.c,comp.std.c,comp.arch