HDTenEightyP/NetNews huggingface dataset:
From: mckelvey@fafnir.com (James W. McKelvey)
Subject: Re: C Language Reference
Reply-To: mckelvey@fafnir.com
Organization: Fafnir Software, Saugus, CA, USA
Date: Sat, 25 Jul 1992 00:02:39 GMT

In article <1992Jul17.150158.20552@seq.uncwi> hotsenp@seq.uncwil.edu writes:
> 
> ken@uctcs.cs.uct.ac.za (Ken MacGregor) writes:
> 
> >I would like to obtain a copy of the ANSI C Language Reference
> >Document.  Does anyone know from whom it is available and the cost.
> 	
>  	If any one has any idea I would like one too......
> 
> 			THANKS IN ADVANCE....
> 
> 
Well, you can write ANSI:
    American National Standards Institute
    1430 Broadway
    New York, NY 10018

But I bought mine at a technical bookstore:
    OpAmp Technical Books
    1033 North Sycamore Avenue
    Los Angeles, CA 90038
    213-464-4322 (they can take orders over the phone)

I think it's about $50.
-- 
A man should not strive to eliminate his complexes, but to get in
accord with them; they are legitimately what directs his conduct
in the world. - Sigmund Freud
Jim McKelvey                      mckelvey@fafnir.com
From: robertk@taoami.lerctr.org (Robert Kesterson)
Newsgroups: comp.lang.c
Subject: Re: HIgher problems at hand. HELP!
Date: 26 Jul 92 05:02:30 GMT
Organization: Not an Organization
X-NewsSoftware: GRn 1.16e (7/4/92) by Mike Schwartz & Michael B. Smith

In article <1992Jul25.142216.5636@druid.uucp> darcy@druid.uucp (D'Arcy J.M. Cain) writes:
> shulick@navajo.ucs.indiana.edu writes:
> >int strstr(char *data, char *chunk)
>
> Actually, strstr() returns a char *.  The actual prototype is:
>
>     char *strstr(const char *, const char *);
>
> >What's wrong with this subroutine?  I'm making strstr() since Amiga C
> >doesn't have it.
[ stuff deleted ]
>
> Are you sure that the Amiga doesn't have this routine built in or something?
> If you are expecting an int index into the string and actually get back a
> pointer you may see results such as these.
[ more stuff deleted ]

I don't know what compiler is in question here, but so far as I know there
should be a strstr() on the Amiga.  I just tried it in SAS/C 5.10, and it
is in there, and works as expected.

--

======================================================
 Robert Kesterson 	    robertk@taoami.lerctr.org
Newsgroups: comp.lang.c
From: ungar@leland.Stanford.EDU (Jeffrey Ungar)
Subject: Re: 386 C Compilers
Organization: DSG, Stanford University, CA 94305, USA
Distribution: na
Date: Fri, 24 Jul 92 17:50:27 GMT

In article <24JUL199211412559@venus.tamu.edu> jle9162@venus.tamu.edu (ECKHARDT, JASON LEE) writes:
>In article <ntfgb4u@Unify.Com>, dbrus.Unify.Com.tsv@unify.uucp (Tim Vannaman) writes...
>>Does anyone recommend a C compiler that will compile in full 386 mode and 
>>extend DOS above the 1 MEG limit?  Let me know.
>>  THANX!
>
>  Yes, if you your on a DOS platform, the Watcom C/386 8.0 is excellent.
>It has a 386 DOS extender which allows your code to run in 386 protected
>mode and of course access all available memory in a flat model fashion.
>  I believe the cost is down to $650 or so from most mail order dealers.
>
    I'll second that recommendation (though the current release is 9.01).
Note that Watcom now has special educational pricing of $250 for students,
etc. Their tech support is also very good.


Newsgroups: comp.lang.c
From: ucismkw@st.unocal.com (Keith Wood)
Subject: Seeking Multi-User Talk C src (?phone,smalltalk?)
Keywords: multi-user talk phone smalltalk
Organization: Unocal Corporation
Date: Wed, 22 Jul 1992 14:58:45 GMT

   I'm seeking C source for a multi-user unix "talk" program which allows multi-
users the ability to "talk" to each other, something like a real-time bulletin 
board.

	Thanks for any help you can provide,

	Keith


-- 
Keith Wood                              Unocal CIS Division
Phone:  (714)693-5847                   P.O.Box 68076          
Email:  keith.wood@st.unocal.com        Anaheim, CA 92817-8076


Newsgroups: comp.lang.c
From: amorgan@Xenon.Stanford.EDU (Crunchy Frog)
Subject: Re: array element swap help
Organization: Computer Science Department, Stanford University.
Date: Thu, 30 Jul 1992 22:07:58 GMT

In article <1992Jul30.203049.2800@klaava.Helsinki.FI> 
  wirzeniu@klaava.Helsinki.FI (Lars Wirzenius) writes:
>amorgan@Xenon.Stanford.EDU (Crunchy Frog) writes:
>>Oh, there is no real way to speed [swapping] up [...]
>
>The best way to speed it up is to eliminate it altogether.  

Huh?  Maybe the constant drug use is getting to me, but I don't see how
you can do that.  Sure, you can reduce it by using a better sort
(as you say below), but to sort things you have to change their position.
 
>The problem
>arose for a sorting application, so perhaps there is a better sorting
>algorithm that could be used (use Quicksort instead of Bubble sort).

Agreed.  I said the request  seemed a little weird.

>On the other hand, if the array elements are large (some kinds of
>structures, say), you can probably speed things up by using an array of
>pointers to said structures instead.  The purpose is to make the array
>elements smaller and thereby reducing the amount of data that has to be
>moved.

Yep.  I alluded to this in my posting, but since I wasn't sure what
the original poster was up to I didn't bother specifying it.

>Lars.Wirzenius@helsinki.fi

C Frog
From: mitchell@mdd.comm.mot.com
Newsgroups: comp.lang.c
Date: 17 Jul 92 18:12 MDT
Subject: Re: trapping "control C"
Nf-ID: #R:13t9osINNqam@darkstar.ucsc.edu:-1109617974:1992Jul17.141248.4837@mdd.comm.m:-1220607600:001:2554
Nf-From: mdd.comm.mot.com!mitchell    Jul 17 18:12:00 1992


in comp.lang.c, dylan@ibmpcug.co.uk (Matthew Farwell) said:

>In article <13t9osINNqam@darkstar.UCSC.EDU> gil@cse.ucsc.edu (Elmer Fudd) writes:
>>can anyone suggest where i can get info/examples on how to trap a
>>control C in a program?
>>[...]
>
>In most cases, using signal() to trap a SIGINT will do what you
>want it to do.  But again, this is machine dependent - under Unix you
>can set the interupt key to be whatever you want (mine is currently set
>to DEL, not CTRL C).
>
>However, here is some code which will probably do what you want it to
>do...
>
>#include <stdio.h>
>#include <stdlib.h>
>#include <signal.h>
>
>void handler()
>{
>	fprintf(stderr, "got a SIGINT. Exiting.\n");
>
>	/* do some cleanup */
>
>	exit(1);
>}
>
>int main()
>{
>	if (signal(SIGINT, SIG_IGN) != SIG_IGN)
>		signal(SIGINT, handler);
>
>	while (1) printf("Output\n");	/* loop endlessly */
>
>	/* NOTREACHED */
>
>	return 0;	/* for gcc -Wall */
>}
>

Having been recently bitten by a signal handler, I thought I'd comment here.

Looking in PJP's "The Standard C Library", chapter 9, I see that he goes on
at some length about syncronization and other problems which can occur in
handling signals.  In part, he says:

  The occurence of a signal introduces a second thread of control within
  a program.  That raises all sorts of issues about syncronization and
  reliable operation.  The C Standard promises little in either regard.
  C programs have been handling signals since the earliest days of the
  language.  Nevertheless, a portable program can safely take very few
  actions within a signal handler.

The case above is pretty vanilla, except for the as-yet undefined cleanup,
since the program terminates from within the handler.  If the handler
didn't terminate, it would have to be very careful about what actions
it took.  The safest approach I know is to do _NOTHING_ inside the handler
except to set a global variable to indicate that the signal occurred, and
place code to test that variable and react to the signal in the mainline
control thread.  PJP points out that even this is not necessarily 100%
bulletproof.  It's generally a good idea, however, to do as little as
possible in a signal handler.

I think it's also a good idea to make that a stylistic habit, and extend the
maxim of doing as little as possible with a signal handler even to handlers
which could terminate the program from within the handler control thread.
Set a flag and return.  React to the flag in the mainline control thread.

-- 
mitchell@mdd.comm.mot.com (Bill Mitchell)
From: clive@mcdd1.uucp (Clive Backham)
Newsgroups: comp.lang.c
Subject: Re: Loop structures
Date: 27 Jul 92 12:18:31 GMT
Organization: McDonnell Douglas,Hemel Hempstead,UK

In article <1992Jul24.003402.9071@unixg.ubc.ca>, lermer@theory.chem.ubc.ca (Noah Lermer) writes:
> I've got a loop flow problem.
> 
>  I read a value from the user
>  Check that the value is valid,
>    if it is then I just want to continue,
>    if it is not, then I display an error and reprompt for the value.
> 
> in pseudocode:
> 
>  :loop
>     get input <---------
>     if (!valid)         |
>       complain to user  |
>       then loop: -------

I'd suggest that you put the <get input, validate> task into a separate
static function that returns non-zero (ie. true) if the input was
invalid. Thus:

    static int getinput()
    {
	get input;
	if (!valid)
	{
	    complain to user;
	    return(1);
	}
	else
	    return(0);
    }

    .....

    while(getinput());
    /* and at this point, the input is valid */

Of course, the "getinput" function will need to be passed whatever 
parameters are required to (i) read the I/O device, (ii) validate the
answer, and (iii) return the valid answer.

- Clive    (mcdd1.uucp!clive@uknet.uucp)
Newsgroups: comp.lang.c
From: amorgan@Xenon.Stanford.EDU (Crunchy Frog)
Subject: Re: Functions Within Functions
Organization: Computer Science Department, Stanford University.
Date: Wed, 29 Jul 1992 19:40:54 GMT

In article <Bs5w39.5ox@news.larc.nasa.gov> 
  wjb@cscsun2.larc.nasa.gov (William J. Bene) writes:

>Is there any way to declare functions within another function like in pascal?

Not according to ANSI C.  GCC 2.x allows you to do it so you can use
that (beware, it is still fairly buggy).  BTW - Why do you want to
do this?  Occasionally I imagine it might be useful for encapsulating
code, but if a function is used in only one place I make it static
and avoid the problem that way (and have portable code). 

C Frog
From: murphy@npri6.npri.com (David P. Murphy)
Newsgroups: comp.lang.c
Subject: Re: About the 'F' in RTFM
Date: 29 Jul 92 05:22:37 GMT
Distribution: world
Organization: NPRI, Alexandria VA


>>close, fred, but no cigar.  assuming for the sake of argument
>>that the information really _is_ in the manual, then the novice
>>says "Oh.  dammit, why isn't there an INDEX in this manual??"
>>
>>me

>At which point you fix him with the look reserved for killing small,
>brain-dead rodents and either point out that the commands are in
>alphabetical order or hand him the book describing the layout of the
>manuals. 
>
>mccall@mksol.dseg.ti.com (fred j mccall 575-3539)

go ahead, compare me to a COBOL programmer.  no doubt this behavior is
healthy for you, and since this is the net i pay no attention to name-calling.

but, pray tell, what does that make the <very bad adjective> person at AT&T
who decided that [a] no index was needed in the System V reference manuals
and that [b] the table of contents didn't need page numbers and that
[c] the "alphabetical" list of commands is only sorted that way _within_
each group, as in make(1) fork(2) cuserid(3C) sin(3F) and so on.

oh, and knowing that the commands are in alphabetical order may not 
may not be of much help, even if you _do_ know the group number.
for instance, fstat() appears only under stat(2), while fileno() is
discussed under ferror(3S).  i realize, of course, that this arrangement
does not inconvenience you at all, fred, and that it is just the dues
i must pay in order to one day be recognized as a unix guru ---
coincidentally the same day i will slash my wrists.

why is the "layout of the manual" so <mind-shockingly rude adjective> sacred
that no index is prepared??  huh??  c'mon, fred, let's hear some reasons!

READ BEFORE FLAMING:  the groups mentioned above, and putting fileno()
under ferror(), is fine . . . or would be, if they would just index it.

ok
dpm
-- 
murphy@npri6.npri.com 602 Cameron St. Alexandria, VA 22314 (703) 683-9090

              When every one is dead the Great Game is finished.  Not before.
                              --- Hurree Babu, "Kim"
From: rod.willmot@synapse.isis.org (Rod Willmot) 
Newsgroups: comp.lang.c
Subject: structure question
Date: 24 Jul 92 19:31:00 GMT
Distribution: world
Organization: SYNAPSE BBS - GATINEAU, QUEBEC - 819-561-4321
Reply-To: rod.willmot@synapse.isis.org (Rod Willmot) 

TO: leegye@vuse.vanderbilt.edu 

To Gyesung Lee regarding his structure question:

GL>main  ()  /* create a global root and set next ptr to NULL */
GL>{
GL>  Global_Root = (A_Type) malloc (sizeof(A_Type));
GL>  Global_Root->next = NULL;
GL>  abc();
GL>}
GL>The right answer should be:
GL>In abc:  is  NULL
GL>In abc1: is  NULL

Wrong!  You only allocated one structure, therefore there is only 
one pointer to be NULL.  The second output line expresses an 
attempt to test a pointer in a structure that was never allocated.
You get a core dump because of an attempt to access an area of 
memory to which the program is denied access.  Rearranging the 
elements of the structure only _seems_ to solve the problem, by 
accidentally making the invalid test point to an area of memory
within the program's legitimate segment.

To make your code bullet-proof, make sure that whenever a ->next 
pointer is NULL, there is no subsequent attempt to access the 
nonexistent structure to which it doesn't point!

rod.willmot@synapse.isis.org    (Rod Willmot)
---
 . DeLuxe. 1.20 #2423 .
From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius)
Newsgroups: comp.lang.c
Subject: Re: linking gcc code with CC code
Keywords: link
Date: 30 Jul 92 20:40:44 GMT
Organization: University of Helsinki

kps@cunixb.cc.columbia.edu (Karthik P Sheka) writes:
>Is it possible to link gcc created object files with CC created object
>files?  

That depends on which CC and which version gcc and which operating
system and on the phase of the moon.  Cross-language calling is always
dependent on these (and other) factors, even for closely related
languages such as C and C++.  You can't even be certain that you can
call subroutines in the same language, if they are compiled with
different compilers (or even using different settings with the same
compiler).

Could you translate everything to C or C++ and use only one compiler? 
This is often the easiest solution.

>I've tried doing so but it seems that the c functions cannot call
>the c++ functions, 

Probably not.  C++ names are usually mangled so that type information
(needed for overloading) is encoded into the name (as the linker sees
it).  However, your sample code shows that there may be other problems
as well: routine2 is declared (and defined) static in one file and
extern in an other.  I assume you meant that both declarations refer to
the same function, so you have to change the static declaration and
definition to be global (just remove the statics).

--
Lars.Wirzenius@helsinki.fi
Newsgroups: comp.lang.c,comp.lang.c++,comp.lang.c,comp.std.c++
From: johnl@iecc.cambridge.ma.us (John R. Levine)
Subject: Journal of C Language Translation
Organization: I.E.C.C.
Date: Wed, 22 Jul 1992 05:34:18 GMT
Followup-To: poster

The Journal of C Language Translation, the leading journal for
implementors of the C and C++ languages, has a new editor and publisher,
and an expanded editorial direction.  The Journal is designed to be a
technical forum for debating issues relevant to the implementation and
extension of the C and C++ languages, their preprocessor and run-time
libraries.

Until this year, the Journal was edited and published by Rex Jaeschke, who
is well known in C standards circles.  Under the direction of the new
editor (me) it retains its existing focus on the C language, with
additional emphasis on the evolution and translation of C++.  Rex
continues as an editorial advisor.

Jim Brodie, the C Standards Editor, is chairman of the ANSI C committee.
Bob Jervis, Numerical Editor, is a member of X3J11.1 and was one of the
primary authors of Turbo C.  P. J. Plauger, Technical Editor, is the ANSI
Secretary, ISO C Convenor, and technical editor of The C Users Journal.
I expect to have a member of X3J16 reporting on C++ news.

Topics in upcoming issues include:

- Interpretation reports from the X3J11 ANSI C committee
- What's new at the ISO WG14 C committee, particular internationalization
  and wide and multi-byte character sets
- What's new at the ANSI X3J16/ISO WG21 C++ committee
- Numerical C extensions from ANSI X3J11.1
- Incremental preprocessing and parsing of C programs
- Parallel and vectorizable versions of C

New subscribers can get a six month trial subscription for $99.  Regular
subscription prices are are unchanged: $235/yr in North America, $250/yr
elsewhere, quantity discounts possible.  Due the the change in editors,
there was no June issue, so the next issue, Volume 4 Number 1, is
scheduled for September.

We're always looking for good articles for future issues on topics of
interest to C and C++ implementors.

For more info on contributing or subscribing, e-mail or write:

Journal of C Language Translation
PO Box 380349
Cambridge MA 02238-0349
-- 
John R. Levine, IECC, POB 349, Cambridge MA 02238, +1 617 492 3869
johnl@iecc.cambridge.ma.us, {ima|spdcc|world}!iecc!johnl
Re-elect Vice President Potatoe-Head !
Newsgroups: comp.lang.c
From: kbass@gmuvax2.gmu.edu (Ken Bass)
Subject: Re: Need help with byte addressable bitfields
Organization: George Mason University, Fairfax, Va.
Distribution: na
Date: Sun, 26 Jul 1992 16:19:53 GMT

In article <1992Jul26.044414.7219@gmuvax2.gmu.edu> kbass@gmuvax2.gmu.edu (Ken Bass) writes:
>I'd like to know your suggestions on how to define and access a bitfield
>that is both bit and byte addressable. The application is to maintain a
>ram image in a memory mapped i/o system.
>
>Lets say we have WidgetRamImg of type WidgetRamImgDef where
>
>typedef struct {
>   unsigned int bit0;
>         ...
>   unsigned int bit32;
>} WidgetRamImgDef;
>
>WidgetRamImgDef WidgetRamImg;
>
>I'd like to say WidgetRamImg=0x0; at init time, but the type is wrong.
>Casting to WidgetRamImgDef does not work either.
>
>Any suggestions?
>
I meant, of course, unsigned int bit0 :1 (after all I am asking about
bitfields)


Currently, I'd like to use union, but I cant do it in one line. 
union RamImgUnion {
   struct {
      unsigned int bit0 :0;
         ....
      unsigned int bit32:0;
   } bit;
   unsigned int byte;
}

typedef union RamImgUnion WidgetRamImgDef

Is there a way to combine this? Also is I define

     WidgetRamImgDef WidgetRamImg;

Then I must access it as either WidgetRamImg.bit.bit7 or
WidgetRamImg.byte. Any way to get around this?



-- 
Ken Bass (kbass@gmuvax2.gmu.edu)              |   Telecommunications  
George Mason University                       |   Techniques Corp, 
Student, Department of Electrical Engineering |   Software Engineer
From: bertele@eniac.seas.upenn.edu (George K. Bertele)
Newsgroups: comp.lang.c
Subject: C Compiler info needed!
Date: 23 Jul 92 23:46:08 GMT
Organization: University of Pennsylvania


Hi out there, I was looking for any information on where to get a C
compiler for the IBM AS/400.  The obvious answer is of course to get 
one from IBM.  We did get that one here at work, but we would like to
compare and contrast with other compilers to get a better idea of the
various features/speeds/etc of some other packages.  

If anyone out there could either tell me about a C Compiler that they
use or know of, that would be great, or if anyone could tell me where
to get this type of information, that would help also.  Infact, even
a company out there that does programming in C on the 400 might also
be of help....so the point is, any info. is appreciated.  Please send
e-mail replies if at all possible.

                                    Thanks,
			            George Bertele
                                    bertele@eniac.seas.upenn.edu
From: au141@cleveland.Freenet.Edu
Newsgroups: comp.lang.c
Date: 18 Jul 92 04:31 MDT
Subject: tell me about Borland C 3.1....
Nf-ID: #N:1992Jul18.003150.17689@usenet.in:28855381:001:861
Nf-From: cleveland.Freenet.Edu!au141    Jul 18 04:31:00 1992



   Since I have started programming OOP, I have decided to finally bite the
bullet and buy one of borlands "professional" packages.

   What I want to know is:  what is the difference between 3.0 and 3.1?  what
is the difference between C++ pro and C++ w/ app. frameworks?  do both include
the source for Tvision (major point in purchase).  Is the documentation on
Tvision the same in both packages?  I ask because just what *besides* manuals
do you put in that HUGE box...  

   and finally: I am a student, and I can get all the proper forms signed (if
neccasary) as well as having several valid student IDs.  Just how and where do
I get borlands educational deal???
-- 
"Stay Sane Inside Insanity" -- The Rocky Horror Picture Show
sysop of the Rocky Horror Picture Show BBS 1-618-529-5999 24Hrs
USR Dual Standard ** programming support ** NON-Etherealized
From: fischer@iesd.auc.dk (Lars Peter Fischer)
Newsgroups: comp.lang.c
Subject: Re: About the 'F' in RTFM
Date: 19 Jul 92 23:27:51 GMT
Followup-To: alt.sex,talk.bizarre
Organization: Mathematics and Computer Science, Aalborg University


>>>>> "Andrew" == Andrew Koenig (ark@alice.att.com)

Andrew> 'RTFM' does stand for 'Read The Manual'.  The 'F' is silent.

Given the usual interpretation of the 'F', this would clearly be the
case only if you are doing a lousy job at it.

/Lars
--
Lars Fischer, fischer@iesd.auc.dk | It takes an uncommon mind to think of
CS Dept., Aalborg Univ., DENMARK. | these things.  -- Calvin
Newsgroups: comp.lang.c
From: darcy@druid.uucp (D'Arcy J.M. Cain)
Newsgroups: comp.lang.c
Subject: Re: HIgher problems at hand. HELP!
Date: 28 Jul 92 18:08:17 GMT
Organization: D'Arcy Cain Consulting

torek@horse.ee.lbl.gov (Chris Torek) writes:
>In article <1992Jul25.142216.5636@druid.uucp> darcy@druid.uucp
>(D'Arcy J.M. Cain) writes:
>> * strstr - find first occurrence of wanted in s
>> *
>> * based on code by Henry Spencer
>> * modified for ANSI by D'Arcy J.M. Cain
>> */
>The given strstr() fails to meet the second sentence under `Returns'
>in the ANSI C standard description of strstr() (line 25, p. 168):
>
>    If |s2| points to a string with zero length, the function
>    returns |s1|.

Oops.  That's right.  The culprit is the optimization attempt in the
while statement:

	while (*s != firstc || strncmp(s, wanted, len) != 0)

Should be:

	while (strncmp(s, wanted, len) != 0)

Or the simpler:

	while (strncmp(s, wanted, len))

This depends on strncmp returning equal on zero length strings.  I am
pretty sure that the standard requires this.  It certainly strongly
implies it.  Perhaps this needs a clarification.

So the new version, without the "peculiar" define, is:

-------------------------------------------------------
#include	<string.h>

char	*strstr(const char *s, const char *wanted)
{
	size_t len = strlen(wanted);

	while (strncmp(s, wanted, len))
		if (*s++ == '\0')
			return(NULL);

	return(s);
}
--------------------------------------------------------

Kluge to taste for warning suppression.

-- 
D'Arcy J.M. Cain (darcy@druid.com)  |
D'Arcy Cain Consulting              |   There's no government
Toronto, Ontario, Canada            |   like no government!
+1 416 424 2871          DoD#0082   |