HDTenEightyP/NetNews huggingface dataset:
From: sasghm@theseus.unx.sas.com (Gary Merrill)
Subject: Re: ++i = i++ ?
Originator: sasghm@theseus.unx.sas.com
Date: Wed, 30 Sep 1992 17:44:21 GMT
Organization: SAS Institute Inc.


In article <1992Sep30.021928.1456@waggen.twuug.com>, alpha@waggen.twuug.com (Joe Wright) writes:
|> Gary Merrill (sasghm@theseus.unx.sas.com) wrote:
|> : 
|> : In article <1992Sep28.184140.4116@kpc.com>, hollasch@kpc.com (Steve Hollasch) writes:
|> : |> 
|> : |>     I'll assume that you made a typo here and really meant to say
|> : |> 
|> : |>         for (i=0; i < Count; ++i)
|> : |>                            ^ A comma here is a syntax error.
|> : 
|> : Well, since no one else pointed this out, and in order to forestall
|> : additional errors and confusion ...
|> : 
|> : A comma here is *not* a syntax error!  The syntax error is
|> : 
|> :          for (i=0; i < Count, ++i)
|> :                                  ^
|> :                                  missing ';'
|> : 
|> : Now I admit that
|> : 
|> :          for (i=0; i < Count, ++i; )
|> : 
|> : would be pretty unusual code, but it is *syntactically correct*.
|> : (And indeed, there *are* cases when one might *want* a comma
|> : operator in the middle clause.)
|> : -- 
|> I don't think so.  The comma operator separates two statements and
|> ensures the statements are evaluated left to right.  Using the above
|> 'i < Count, ++i;' as a for control will ignore the 'i < Count' and
|> return the ++i condition.  The condition will be 'true' until i goes
|> from -1 to zero.  Not very useful.

You misread my claim.  I did not mean to say, "there are cases when
one might want a comma in *this* middle clause," but to assert the
more general claim that there are cases when a comma in the middle
clause of a 'for' statement would be advantageous.  In fact, another
correspondent has sent me an interesting (if somewhat horrifying)
example of just this.
-- 
Gary H. Merrill  [Principal Systems Developer, C Compiler Development]
SAS Institute Inc. / SAS Campus Dr. / Cary, NC  27513 / (919) 677-8000
sasghm@theseus.unx.sas.com ... !mcnc!sas!sasghm
From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe)
Newsgroups: comp.lang.c
Subject: Re: C help...pretty please.
Date: 30 Sep 92 06:13:31 GMT
Organization: Comp Sci, RMIT, Melbourne, Australia

In article <Sep.29.02.35.35.1992.4194@clam.rutgers.edu>, dalessan@clam.rutgers.edu (Gene Dalessan) writes:
> #include <math.h>
> PLEASE help...Why do I get undefined _cosh?

It would help everyone if you said _WHAT_ program talks about cosh being
undefined.  Making an educated guess, I just sent this to Steve Summit for
inclusion in the FAQ:

Proposal for addition to the C "Answers to Frequently Asked Questions" list.

Section 14. Library Subroutines

<<new subsection>>

14.16:	Why can't I use math functions?

A:	In order to use functions like sqrt() and pow() you must
	#include <math.h>
	in each source file that mentions these functions.  Many C systems
	also require you to tell the linker where to find the functions.
	UNIX C compilers want you to list libraries at the END of the "cc",
	"c89", or "gcc" command.  "-lm" is how you ask for the math library.
	Example:  cc main.c subs.c -lm

	Check your compiler documentation to find out which libraries you
	have to load explicitly (<math.h> is the only standard library which
	commonly needs explicit mention) and how.

-- 
RMIT policy requires the use of Gender Inclusive Language in all publications
and in all information conveyed to students, staff, and potential job
applicants.  Lapses into English are the sole responsibility of the author.
The Constitution of Australia does _not_ guarantee Freedom of Speech.
From: dmills@accvio.intel.com (Dave Mills)
Newsgroups: comp.lang.c
Subject: Re: "Illegal Pointer Arithmetic" error
Date: 30 Sep 92 15:43:00 GMT
Distribution: usa
Organization: Intel Corporation
News-Software: VAX/VMS VNEWS 1.41

In article <6518@blue.cis.pitt.edu.UUCP>, willdm+@pitt.edu (William D Moore) writes...
>Can anyone tell me why I get the compile time error "Illegal Pointer 
>Arithmetic" ... 

>ParseCommand(buf,args)
>char *buf;
>char **args;
>{
>	while(buf!=NULL)
>	{
>		/*
>		  Strip out the white space between each argument,
>		  and insert a NULL termination at the end of each
>		  argument instead.
>		*/
>		if(isspace(*buf))
>		{
>------------->	     *buf++=NULL;

There's a difference (noted in the FAQ, I presume) between NULL and NUL.  Your
"while(buf!=NULL)" refers correctly to a "NULL pointer".  "*buf++=NULL;",
though doesn't make sense.  The NUL character (ASCII 0) is defined as NUL with
one 'L', and that's what you want to stuff into buf. 

Dave
-----------------
David Mills
Intel Corporation
dmills@intel.com
Newsgroups: comp.lang.c
From: cariapa@angelo.amd.com (Sandeep Cariapa)
Subject: Re: Memory leak detectors: references?
Keywords: References to publications on memory leak detectors
Organization: Advanced Micro Devices, Santa Clara, CA
Date: Wed, 30 Sep 1992 00:51:39 GMT

In article <Sep.21.16.32.47.1992.10978@yoko.rutgers.edu> bsriram@yoko.rutgers.edu (Sriram) writes:
>
>I have a friend who is trying to  implement a garbage collector /
>memory leak detector for C (Unix systems) programs for a class project
>and I was wondering if someone could point him to research papers (or
>public software) that talk about memory leak detection/ garbage
>collection for C programs.
>
>Any help given would be greatly appreciated. Please email responses to
>bsriram@paul.rutgers.edu.
>
>Thanks in advance.
>
>	Sriram.


	If your friend can get his hands on the San Francisco USENIX
1992 proceedings, there is a paper on a product called Purify, brought
out by a company called  Pure Software. Purify detects memory leaks in
programs. It is an excellent product, and a very interesting paper to
read as well. No, I have no affliation with the company, only
technical interest.  

	Hope this helps, 
Sandeep
--
Sandeep Cariapa, Systems Engineer, CTS/DSN.
cariapa@amd.com, 408-987-9043
Eagles may soar, but weasels don't get sucked into jet engines.
Newsgroups: comp.lang.c
From: simonm@mel.dit.csiro.au (Simon McClenahan)
Subject: Re: C-formattors (problems with very long lines)
Organization: CSIRO DIT (Melb.)
Date: Wed, 30 Sep 92 02:27:56 GMT


In article <1992Sep29.073835.29459@olymp.informatik.uni-bonn.de>, hermann@uran.informatik.uni-bonn.de (Hermann Stamm) writes:
|> 
|> I tried to use "indent" and "cb" on the preprocessed text,
|> but got errors
|> 
...
|>   2. Is there a beautifier available working correct even
|>      on very long Source-lines ?


Try GNU's "indent" ... from wherever you get GNU stuff ...

indent-1.6.tar.Z is the latest version.

--
Simon.McClenahan@mel.dit.csiro.au  \_\_ CSIRO Supercomputing Support Group
CSIRO Division of Information Technology _\_\_\_\_\_\_ tel: +61 3 282 2623
723 Swanston St, Carlton 3053 AUSTRALIA \_\_\_\_\_\_\_ fax: +61 3 282 2600
  Don't care if you're rich or not, as long as you can live comfortably and
Newsgroups: comp.lang.c
From: brown@NCoast.ORG (Stan Brown)
Subject: Re: change the environment variable permanently after the program exits
Organization: Oak Road Systems, Cleveland Ohio USA
Date: Sun, 27 Sep 1992 16:06:39 GMT

In article <25SEP199216085531@nssdca.gsfc.nasa.gov> li@nssdca.gsfc.nasa.gov (Constance Y. Li (301)513-1649) writes:
>Is there a way to change an environment variable in a C program and have it
>stayed changed after the program exits?  I tried putenv() but loses the value I
>assigned to the symbol after my program terminates.

It's no accident that ANSI C includes getenv( ) but not putenv( ).
The latter can not be implemented on some operating systems; on others
it can be implemented but with difficulty.

You don't say which operating system you're interested in.  (You appear
to be posting from a VAX/VMS system.)  If by some chance you're
interested in doing a permanent putenv-style operation in MS-DOS,
you'll find answers in the comp.os.msdos.programmer FAQ list.
-- 
Stan Brown, Oak Road Systems                      brown@Ncoast.ORG
Cleveland, Ohio, USA
Newsgroups: comp.lang.c
From: "chris perkins" <chris.perkins@canrem.com>
Subject: easter was: re: algor
Reply-To: "chris perkins" <chris.perkins@canrem.com>
Organization: Canada Remote Systems
Distribution: comp
Date: 1 Oct 92 06:23:32 EST


HH>    Subject: Easter was: Re: Algorithm for Day-Of-Week NEEDED

HH>Does anyone have working C-code to determine when it is Easter in a
HH>given year? It would be handy since I am currently writing a calendar
HH>utility in C. Pointers to such code would also be appreciated.

Donald Knuth quotes an algorithm in Vol. 1 of his well known series
pp. 155-156.

Regards,

Chris
---
  DeLuxe/386 1.25 #9629  Best wishes,            Chris Perkins
--
Canada Remote Systems  - Toronto, Ontario
World's Largest PCBOARD System - 416-629-7000/629-7044
Newsgroups: comp.lang.c
From: karl@ima.isc.com (Karl Heuer)
Subject: Re: The FAQ is on its way?
Organization: Formerly of Interactive Systems, Cambridge, MA
Date: Tue, 29 Sep 1992 16:30:58 GMT

>>The FAQ is on its way.  (This is mentioned in 3.3.)
>
>I keep reading that the FAQ is on its way, and I keep waiting for it to be
>posted, but I never see it.

I post "The FAQ is on its way" when I've just sent it by email, so that other
people in the newsgroup will realize that there's no point in repeating what
the FAQ already says.  (Effectively, it means that this topic is closed,
unless you really have something new to say about it; note that even in that
case, it may be better to email the FAQ keeper instead.)

It gets posted at the beginning of each month.  (So you might as well just
watch for the next one, now.)

Karl W. Z. Heuer (karl@ima.isc.com or uunet!ima!karl), The Walking Lint
Newsgroups: comp.lang.c
From: judym@col.hp.com (Judy Miller)
Subject: Re: What is RPG ???
Date: Fri, 2 Oct 1992 15:00:17 GMT
Organization: HP Colorado Springs Division

books@fsunuc.physics.fsu.edu (Roger Books) writes:
> In article <1992Oct2.015817.183@wsuhub.uc.twsu.edu> ckcheng@wsuhub.uc.twsu.edu writes:
> 
> >     Hey, does anybody heard of RPG (language or system?, NOT role playing 
> game>) ?  Can anyone talk about it in this category or open a new category ?
> 
> Report Program Generater

The opposite of OOP!  
Actually, it was a step towards 4GL.
Businesses would use RPG instead of COBOL to generate reports since it
had a looping mechanism built in.  Very archaic ... uses switches.
The real fun is when programmers used it to do complicated logic ...
my office had one program which used up all 99 switches and had to
reuse some.  Can't image supporting it.  I've heard some businesses
still use this language.  Ugh!  I had to opportunity to learn it 9 years
ago to support a few programs until we obsoleted them.
Since logic was built into the language, you had to "THINK RPG" as the 
motto goes.

Judy
Newsgroups: comp.lang.c
From: caro@uni-paderborn.de (Carsten Rose)
Subject: Re: Bus Error???
Organization: Uni-GH Paderborn
X-Newsreader: TIN [version 1.1 PL6]
Date: Thu, 1 Oct 1992 09:09:04 GMT

Hi,


Joseph Good (rscott@spock.NMSU.Edu) wrote:
: 
: ACK!!
: 
: I am trying to make a NFF to Rayshade 4.0 file converter, and for some
: stupid reason, I keep getting a nice BUS ERROR message after
: everything is compiled and done.
: 
: It happens when i try to read from the file, no matter what function I use.. be  
: it fscanf.. fgets..  anything --> bus error.
fscanf is your problem !!

--------------------------
: 
: 	while (!feof(infp)) {
: 		fscanf(infp, "%s %f %f %f", head, arg1, arg2, arg3);
: 		printf("head = %s %f %f %f\n", head, arg1, arg2, arg3);
: 		fseek(infp, 80, SEEK_CUR);

------------------------

fscanf needs always adresses to store the read values !!
So write a '&' in front of any int's and float's !!
If the variables are already pointers, you don't need that.
Solution:
                fscanf(infp, "%s %f %f %f", head, &arg1, &arg2, &arg3); 
                                                  ^      ^      ^

Hope it help's


Ciao
	Carsten

Carsten Rose, Germany           | Life. That's what happens while
EMail : caro@uni-paderborn.de   | you're thinking about the future
Newsgroups: comp.lang.c
From: Leonid A. Broukhis <leo@ipmce.su>
Subject: Re: Common C errors (was Strange memory allocation...)
Reply-To: leo@ipmce.su
Organization: unknown
Date: Sun, 27 Sep 92 20:55:28 +0400

In comp.lang.c article <717558228snx@Wellspring.COM> Elliot H. Mednick
    writes:

>A common (maybe not THE most common, but close) error in C (reason #215
>that I wish the general computing community would allow me to program in
>Some Other Language and not laugh me out of an interview for knowing PL/1)
>is:
>
>b == a;            /* an attempted assignment */
>
>This statement does nothing, but cannot be flagged as a warning.

	WARNING! NULL EFFECT!

(As in: char *p; .... *p++; ...) - instead of (*p)++.

>(In case anyone cares, reason #1 is there _isn't_ a book called
>"Modula II Puzzle Book", or "Pascal Puzzle Book", or "PL/1 Puzzle Book".)

	In case anyone cares, there is a book called
"FORTRAN Puzzle Book" (in Russian, though). It is _obvious_ that the
more the language is used, the more puzzles are derived from its
usage. And vice versa - hackerdom won't die...

>(And while I'm on a roll, reason #2 is that C is _not_ portable.)

	Yeah, C has no handles ;-) ;-) .
-- 
	Leonid A. Broukhis
From: karl@ima.isc.com (Karl Heuer)
Newsgroups: comp.lang.c
Subject: Re: Is there is (pascal) WITH equivalent in C?
Date: 27 Sep 92 17:50:04 GMT
Organization: Formerly of Interactive Systems, Cambridge, MA

In article <1992Sep26.070303.28411@cronkite.ocis.temple.edu> ray@astro.ocis.temple.edu (Ray Lauff) writes:
>When programming in (sigh) Pascal there is a WITH statement which
>allows all the references to a structure to be referenced without
>repeating the struct variable name.  Is there such a thing in C?

Here is the corresponding idiom in C.

/* WITH alpha[i].beta^.thingbuf[j] DO BEGIN c = a + b END; */
{
    thing_T *p = &alpha[i].beta->thingbuf[j];
    p->c = p->a + p->b;
}

Karl W. Z. Heuer (karl@ima.isc.com or uunet!ima!karl), The Walking Lint
(This article is informative only; it does not contain opinions on the
relative merits of the two constructs, nor of the languages in general.
Let's keep it that way.)
From: jos@and.nl (Jos Horsmeier)
Newsgroups: comp.lang.c
Subject: Re: C help...pretty please.
Date: 29 Sep 92 13:35:46 GMT
Organization: AND Software BV Rotterdam

In article <Sep.29.02.35.35.1992.4194@clam.rutgers.edu> dalessan@clam.rutgers.edu (Gene Dalessan) writes:
|
|#include <math.h>
|#include <stdio.h>
|main()
|{
|double val=-1.0;
|
|do {
| printf("hyperbolic cos %f is %f\n",val,cosh(val));
| val +=0.1;
| } while (val<=1.0);
|}
|
|
|PLEASE help...Why do I get undefined _cosh?
|
|I'm learning C know and this example is out of the book.
|I need the cosh for a numerical meth problem.

If you're working on a Un*x box, did you tell the linker to include
the math library, like this:

cc yourprog.c -lm

Sometimes people make the mistake by typing something like this:

cc -lm yourprog.c

The (braindead) one pass linker scans the command line arguments from
left to right and if it reads the math lib first, it can't find any
references (yet) to the cosh() function, so it simply skips it.

If you _didn't_ make this mistake and if your math lib _doesn't_
have the cosh() function included (which is very unlikely,) you
can always implement it yourself:

double cosh(x)
double x;
{
	return (exp(x)+exp(-x))/2.0;
}

I hope this helps a bit,

kind regards,

Jos aka jos@and.nl
From: dave@cs.arizona.edu (Dave Schaumann)
Newsgroups: comp.lang.c
Subject: Re: Probably a simple realloc() question
Date: 2 Oct 92 08:06:10 GMT
Reply-To: dave@cs.arizona.edu (Dave Schaumann)
Organization: University of Arizona

In article <23779@alice.att.com>, ark@alice (Andrew Koenig) writes:
>In article <358@ulogic.UUCP> hartman@ulogic.UUCP (Richard M. Hartman) writes:
>
>> There is no reason
>> for downsizing a dynamically-allocated block of memory to fail.
>
>Sure there is.
>
[...]
>Suppose further that your system provides no way to shrink the size
>of an allocated block.  If your user requests such shrinkage, you
>really have only two choices:
>
>	1. Don't return any memory to the system, but lie and tell
>	   the user you did, or
>
>	2. Allocate new memory, copy the stuff, then free the old.
>
>While I won't argue that (2) is always the best strategy, is is
>surely best sometimes.

What's wrong with

	void *realloc( void *p, unsigned s ) {
	  void *new_p ;
	  if( (new_p=malloc(s)) == NULL ) {
	    errno = ENOMEM ; return p ;
	    }
	  bcopy(p,new_p,min(s,SIZE(p))) ;
	  free(p) ; return new_p ;
	  }

	/* SIZE(p) is some system-dependant thing that */
	/* gives the size of the chunk of memory p points to */

A nice, simple interface, that works on your system, and does something
reasonable besides failing when there's no new memory to copy to.  The
error condition is still detected and signalled to the user, but IMHO
in a much more robust way than returning NULL.

Sure, this code still `fails', but it's much easier for the user to
ignore that failure when it's convenient to do so.

-- 
Dave Schaumann			dave@cs.arizona.edu
From: mccall@mksol.dseg.ti.com (fred j mccall 575-3539)
Newsgroups: comp.lang.c
Subject: Re: Is there is (pascal) WITH equivalent in C?
Date: 6 Oct 92 17:01:56 GMT
Article-I.D.: mksol.1992Oct6.170156.5841
Organization: Texas Instruments, Inc

In article <1992Oct1.114517.3937@rz.uni-karlsruhe.de> ae24@iamk4516.mathematik.uni-karlsruhe.de (Peter Januschke) writes:
>
>That's just not true. Most non-optimising compilers would generate better
>and faster code from a WITH construct than from the corresponding construct
>without WITH.

And just how many totally non-optimizing Pascal compiilers do you know
of in the real world that are being used for anything where 'better
and faster code' would matter?


-- 
"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: CROMERO@vmtecqro.qro.itesm.mx
Newsgroups: comp.lang.c
Subject: Problems accesing real addresses in Intel Code Builder
Date: 5 Oct 92 16:11:28 GMT
Organization: Instituto Tecnologico de Monterrey, Campus Queretaro


 
I hope somebody know how to solve this. Im using Intel C Code Builder and a DT2
867-LC Data Translation Frame Grabber card. The problem is that this card
uses memory address above 640K by default A00000h, this only can be accesed by
real-mode DOS via a Extended Memory device driver that is included with the car
d, but whit Code Builder the extender sets virtual memory adresses beginning
in 32M, addresses between 1M and 32M-1 are not accesible. We cannot then access
frame grabber memory directly, we have to do it using I/O ports calls this is a
 really slow way. I want to know how i can trick the ICB extender and
use card memory without using intermode buffering to use real-mode drivers in p
rotected mode.
Using dpmi_alloc doesnt work (and this function is not very well-documentated).
If anybody know how to solve it please mail me, thankXs in advance .
 
Carlos Romero
ITESM campus Queretaro
OptoElectronics Development Group
Email : cromero@vmtecqro
From: reza@loki.jsc.nasa.gov (Reza Razavipour)
Newsgroups: comp.lang.c
Subject: Sockets
Date: 28 Sep 92 14:57:03 GMT
Organization: Lockheed Eng & Sci

I have never used sockets and I will be getting into them 
hot and heavy pretty soon here. Can anybody provide a small
set of code to be used to learn from or the name of a good 
reference book?
Thanx in advance.
Reza.
From: kdq@quest.UUCP (Kevin D. Quitt)
Newsgroups: comp.lang.c
Subject: Re: Untyped pointer arithmetic
Date: 1 Oct 92 17:35:08 GMT
Reply-To: srhqla!quest!kdq
Organization: Job quest  (805) 251-8210,  So Cal: (800) 400-8210

wilson@gauss.cs.jhu.edu (Dwight Wilson) writes:
> In article <14813@goanna.cs.rmit.oz.au> ok@goanna.cs.rmit.oz.au (Richard A. O
> >So it is syntactically legal to do
> >	void *p, *q;
> >	ptrdiff_t d;
> >	d = (char*)q - (char*)p;
> 
> Not quite.  This is only a legal pointer operatin if p and q point
> to members of the same array, or either is the address of the first 
> element past the the end of an the array.  

Do you really mean legal, or do you mean meaningful?


 _
Kevin D. Quitt                                 Job Quest (800) 400-8210
srhqla!quest!kdq                               Learn How to Get a Job in SoCal

                96.37% of all statistics are made up.
From: hartman@ulogic.UUCP (Richard M. Hartman)
Newsgroups: comp.lang.c
Subject: Re: Strange memory allocation error on exiting C program
Date: 29 Sep 92 21:04:59 GMT
Article-I.D.: ulogic.308
Organization: negligable

In article <buyi6f.f1q@wang.com> dbushong@wang.com (Dave Bushong) writes:
>linstee@dutecaj.et.tudelft.nl (Erik van Linstee) writes:
>>alexp@chaos.cs.brandeis.edu (Alex Prengel) writes:
>>Go and check all your pointer references, somewhere somehow you are
>>referencing an undefined pointer, that is, a pointer that has NOT
>>been initialised with malloc. This is the most common error made
>>in C programming, 
>
>Bzzzzzt.  Wrong.  I just checked every C program ever written (whew!).
>The most common error made in C programming is the so-called "single-
>equals" error, e.g.,  


Dave, I hate to say it, but you're wrong.  The single-equals error
may be the most common error made by novice programmers, but you
eventually get used to typing == and barring typos it becomes
very infrequent, wild pointers however are something that can happen
in more than one different ways (two of the most common: not initialized, 
freed then referenced).  These kinds of errors dog most programmers
throughout their carreers (myself excluded, of course ;)

		-Richard Hartman
		hartman@ulogic.COM

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Smoke me a kipper, I'll be back for breakfast!"
From: dmf@drsrv1.hmi.de (Fromme_Michael)
Newsgroups: comp.lang.c
Subject: Re: C help...pretty please.
Date: 29 Sep 92 15:10:39 GMT
Organization: Hahn-Meitner-Institut Berlin GmbH

Try the -lm option to link the math lib
Newsgroups: comp.lang.c
From: levin@world.std.com (Levin F Magruder)
Subject: Scanf: Required white space; Macros in the format
Organization: The World Public Access UNIX, Brookline, MA
Date: Thu, 1 Oct 1992 15:39:32 GMT

Two scanf questions (actually sscanf, but I can't imagine there's
a difference here.)

1.  Is there a way to require whitespace for a match with scanf?
Or the absence of white space?

I'm reading a file that always has a number at the beginning of
lines I'm interested in, any line that starts with a space I don't
want (the first non-whitespace may well be a number, I still don't
want that line).

I know it only takes two lines to deal with the problem
in other ways.

2.  Is there a way (maybe stringizing and relying on concatenation?)
to use macro replacement in the format string?  To avoid:

  sprintf(formatstring, "%%ld %%%ic", NAMELENGTH) ;
  fieldsread = sscanf( linebuffer, formatstring, &numberbuffer, namebuffer) ;