HDTenEightyP/NetNews huggingface dataset:
From: gordon@sneaky.lonestar.org (Gordon Burditt)
Subject: Re: Common C errors
Organization: Gordon Burditt
Date: Thu, 1 Oct 1992 12:00:07 GMT

>This statement does nothing, but cannot be flagged as a warning.

According to the ANSI C standard, any statement can be flagged as
a warning.  (The compiler is probably limited to a finite number
of warnings, though, as an infinite number of warnings would probably 
be considered a failure to translate the code).

The warnings may be about anything, regardless of truth, relevance,
or assininity.  For example:

	j = 0;
***WARNING*** This line of code fails to Praise the Lord!
	for (i = 0; i < 10; i++)
***WARNING*** Hardcoded constants are bad style, use a #define!
***WARNING*** This line does not contain a comment.
	{		/* open brac */
***WARNING*** Comment states the obvious
***WARNING*** Spelling error in comment
***WARNING*** Dan Quayle may be President!  Beware!	
	}		/* end of for loop */
***WARNING*** Undeclared variable MotherChristmas
(Who cares if we didn't USE such a variable?)
***WARNING*** Your lunch is getting cold.

					Gordon L. Burditt
					sneaky.lonestar.org!gordon
Newsgroups: comp.lang.c
From: esova@magnus.acs.ohio-state.edu (Edward R Sova)
Subject: Dr. Dobbs index
Organization: The Ohio State University
Date: Fri, 2 Oct 1992 13:15:27 GMT

I caught part of the thread this week talking about a database library from
Doctor Dobbs.  Where can I find this library on the internet, better yet
where can I get an index to this magazine.  Thank you.


  ___
  \  \      Mr. Ed on rollerblades?  Nah, that's:
  _\  \      esova@magnus.acs.ohio-state.edu       Prodigy:CBGX09A
 \_____\       but his friends call him Ed,
 o o o o                    yeah that Ed Sova Kid, he answers to anything.
From: guenther@stolaf.edu (Philip A Guenther)
Newsgroups: comp.lang.c
Subject: Re: 'make' woes (won't catch secondary dependancy)
Date: 1 Oct 92 06:17:33 GMT
Followup-To: comp.lang.c
Organization: Academic Computing Center, St. Olaf College

In article <BvFB6o.A1w@news.cso.uiuc.edu> gbnewby@uxh.cso.uiuc.edu (Gregory B. Newby) writes:
   Greetings, wise ones.  I'm surprised that 'make' doesn't catch
   this problem, and would be very excited to hear of a good 
   solution or workaround.

   I have a header file that #include's another header file.  I
   would like for my 'make' to catch whether either of them are 
   modified.  Here is a very simple example of what goes wrong
   (of course, what I'm doing is a bit more complicated....hence,
   just putting "test.o: h1.h h2.h" will work in this example,
   but will not give me the freedom & capability I need to be
   happy):

<string of examples deleted>

You need to set hidden dependencies on in your makefile.  If hidden
dependencies is set then make queries cpp(1) for files that are
included by dependency tree files, and they are added to the
dependency tree.  There are several ways to activate this; the easiest
(I think) is to give the target .KEEP_STATE somewhere in your
makefile.  See the man page for other ways to do so.

   Get it?  Any workaround or syntax that I missed would be appreciated!
   I replicated this problem under AIX on a PS/2, SunOS 4.0, and Irix.
   GNUMake doesn't have the problem, but it also didn't catch whether the
   files were up to date or not (that it, it compiled anyway!  No
   matter what!  Perhaps someone here installed GNUMake wrongly...). 
   Thanks!!!

Note: this is true for SunOS 4.1.x make (but not old-make).  I don't
know about the others (though I do know that Sun Make (and Gnus Make)
has several features (pattern matching, for instance) that other makes
don't.  So Your Mileage May Vary by manufacturer, make and model of
make. :-)  And yes, I think that your version of Gnu Make is broken.

     -- Greg Newby

Philip Guenther

--
guenther@stolaf.edu (Philip Guenther)       | The ACC might agree with me,
Student Sys Prog, Academic Computing Center | but with that bunch, (and me)
St Olaf College, Northfield, MN 55057-1001  | you never know... :-) :-| :-(
"Life makes sense?  LIFE MAKES SENSE!!?  Where do people get these ideas?"-me
Xref: sparky comp.lang.c:14530 comp.sources.wanted:4552 comp.msdos.programmer:63 comp.misc:3866
From: draper@ais.org (Patrick Draper)
Newsgroups: comp.lang.c,comp.sources.wanted,comp.msdos.programmer,comp.misc
Subject: Re: Wanted: C-isam library for Turbo C or Microsoft C
Date: 5 Oct 92 01:31:05 GMT
Organization: UMCC

In article <1992Oct2.132840.27055@jmp.com> gbm@jmp.com (Gary McKenney) writes:
>In article <1992Sep30.171329.10078@di.unipi.it> Nico Tranquilli <@> writes:
>>Does anyone have (or know where to find) C-Isam libraries for
>>Microsoft C 6.00 or Turbo C 2.0 compiler ?
>
>A good set of routines is C-Tree from FairCom.  
>
>Code is very portable and reliable.  I've been using it for years.
>(There, you have my testimonial..)
>
>You can order it through Programmer's Paradise for $476.00
>1-800-445-7899
>
>Gary McKenney 

Agreed. C-tree *is* reliable and portable, however, the documentation
really stinks.

In my opinion, if you're not looking for a terribly powerful and complex
system as C-tree is, try the Paradox Engine from Borland. It's about 99
bucks and the documentation is about 3/4" thick and easy to read and use.

Also, try Mix Software's 20 dollar database toolchest. I've heard good
reviews of that, although I have no personal experience. The price is
certainly right.


------------------////////////////////\\\\\\\\\\\\\\\\\\\\------------------
| Patrick Draper           Disclaimer:  I can't control my fingers,        |
| draper@umcc.ais.org                   I can't control my toes! - Ramones |
| University of Michigan Computer Club                                     |
NO CARRIER                     We are a nation of laws, not people         |
------------------\\\\\\\\\\\\\\\\\\\\////////////////////------------------
Newsgroups: comp.lang.c
From: abutler@ariel.demon.co.uk (Tony Butler)
Subject: Multiple assignments
Distribution: world
Organization: Megadodo, Inc.
Date: Mon, 28 Sep 1992 13:59:27 +0000

Hi,

  If I have a piece of code as follows:-

      char *p,*s;
      s=p=malloc(sizeof(char));

  Does this allocate the memory to p and then make s point to the same
  location, or do p and s both get seperate areas of memory allocated to
  them?


   Tony.


 ----------------------------------------------------------------------------
| Tony Butler                           Internet: abutler@ariel.demon.co.uk  |
| Surrey,                                 TCP/IP: 158.152.8.125              |
| England.                               Fidonet: Anthony Butler @ 2:250/408 |
 ----------------------------------------------------------------------------

Newsgroups: comp.lang.c
From: andreas@andreashact.de (Andreas Kesenheimer)
Subject: Re: Passing by reference
Organization: Halstenbach ACT GmbH
Date: Fri, 02 Oct 1992 07:56:06 GMT
Keywords: structs, reference, pointers, global variables

In article <1992Sep25.011338.391@wam.umd.edu>, castanos@wam.umd.edu (Jose Alberto Castanos) writes:

(...)

|> Function (and this is where the problem is):
|> -------------------------------------------
|> 
|> int MyFunc (MyStruct *ALocStruct) {
|>   
|>   *ALocStruct = *((MyStruct *) malloc (sizeof (MyStruct)));
|>      .
|>      .
|>      .
|> }
|> 
|> What I want the code to do is make the global AStruct point to
|> the space allocated in MyFunc.  Any help would be greatly appreciated.

A close look at the malloc - prototye should make it clear:

char *malloc(unsigned int)
or
void *malloc(unisgned int)

(depends on daytime :-)

so 

ALocStruct = (MyStruct *) malloc(sizeof(MyStruct));

should work better since AlocStruct is allready a pointer and needs no
reference.

And remember that sizeof(MyStruct) should return the size of a POINTER (mostly
4)

Hope it helped

	Andreas

--
  +--+  +--+
 +--+| +--+|    Andreas Kesenheimer
 |  |+-|  ||
 |  +--+  ||    Halstenbach ACT GmbH		Telefon.: +49 2261 72051
 |  HACT  ||    Breidenbrucherstr. 2		Fax.....: +49 2261 72054
 |  +--+  ||                      		
 |  |+ |  |+  D 5276 Wiehl-Bomig		Internet: andreas@hact.hact.de
 +--+  +--+
From: ark@alice.att.com (Andrew Koenig)
Newsgroups: comp.lang.c
Subject: Re: unpredictable post-decrement behavior.
Date: 30 Sep 92 22:38:58 GMT
Article-I.D.: alice.23767
Reply-To: ark@alice.UUCP ()
Organization: AT&T Bell Laboratories, Murray Hill NJ

In article <1992Sep30.165412.29208@ugle.unit.no> bjornmu@idt.unit.no (Bj|rn P. Munch) writes:

> |> The behavior for n++ is NOT undefined or unpredictible.

> But is IS.  Sort of.  What is undefined is _when_ the actual update to
> the variable n takes place, and also the order of evaluation of the
> variuos terms in the expression.

Well, if you want to be exceedingly legalistic, the situation is slightly
worse than that.  If you read the C Standard, you will find that it does
not define the meaning of things like

	n = n++;

except to say that they cannot be part of a `conforming program.'  The C standard
defined the meaning of conforming programs and says nothing whatever about the
meaning of non-conforming programs.  That means that I can write a C compiler
that, when given the statement above, will delete all your files, and it
will not violate the Standard.

In other words, the behavior of things like this is really, truly undefined.
Whether it's unpredictable depends on how good you are at second-guessing
your implementation.
-- 
				--Andrew Koenig
				  ark@europa.att.com
From: mike@pacsoft.com (Mike Stefanik)
Newsgroups: comp.lang.c
Subject: Re: Curses to write to stderr, possible?
Date: 3 Oct 92 07:30:20 GMT
Organization: Pacific Software Group, Riverside, CA

In article <364@ulogic.UUCP> hartman@ulogic.UUCP (Richard M. Hartman) writes:
>If you can isolate the curses stuff in subroutines you could
>always play games w/ the file pointers....
>
>displaySomething(...)
>{
>FILE *old = stdout;
>
>	stdout = stderr;
>
>	....
>
>	stdout = old;
>}

In all of the stdio implementations that I've seen, stdin, stdout and stderr
are defined as (&_iob[0]), (&_iob[1]) and (&_iob[2]), respectively. This
means that your code becomes:

displaySomething(...)
{
FILE *old = (&_iob[1]);

	(&_iob[1]) = (&_iob[2]);	/* this is illegal ... */

	....

	(&_iob[1]) = old;		/* ... and so is this */
}
-- 
Mike Stefanik  mike@pacsoft.com  ...!uunet!pacsoft!mike  (714) 681-2623
Pacific Software Group, Riverside, CA
From: scotth@felix.filenet.com (Scott Hopson)
Newsgroups: comp.lang.c
Subject: Re: What is RPG ???
Date: 3 Oct 92 09:21:32 GMT
Reply-To: scotth@fritz.filenet.com (Scott Hopson)
Organization: FileNet Corp., Costa Mesa, CA

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 ?


RPG stands for "Report Program Generator" this language is very OLD and
probably only found on various IBM System 36s and the like.

This language was once thought to be DEAD, though in recent decades it has been
resurrected and upgraded to at least "RPG III".

People in this group probably won't want to discuss it much.

Those who do will be showing their age. :-)




-- 
Scott Hopson   (scotth@filenet.com)
From: hartman@ulogic.UUCP (Richard M. Hartman)
Newsgroups: comp.lang.c
Subject: Re: Union-initialization portability
Date: 1 Oct 92 21:50:31 GMT
Organization: negligable

You can't use a function call in a constructor.

There seems to be nothing wrong w/ your example ... you seem worried
that you haven't "cast back" the pointer into it's proper type.  You
have.  That is what a union does -- provides multiply-typed handles
to the same data.  In Pascal the ONLY way to cast data from one type
to another is by stuffing it through a "variant record" structure (the
Pascal equivilant of a union).

		-Richard Hartman
		hartman@ulogic.COM

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Practice random kindness and senseless acts of beauty.
From: ccurtis@acsu.buffalo.edu (Chris Curtis)
Newsgroups: comp.lang.c
Subject: Interfacing C and Lisp
Date: 1 Oct 92 14:24:18 GMT
Organization: State University of New York at Buffalo / CEDAR Research Group


  Does anyone have any information regarding calling lisp functions
from a C program?  That is, given a main driver program written in C,
is it possible to interface with exisiting lisp routines?  If it makes
any difference, this is to be done in a Unix environment.

  Any and all responses will be greatly appreciated.  Please e-mail
me since I cannot always keep up with this news group.


Thanks in advance,

Chris Curtis (e-mail: ccurtis@cs.buffalo.edu)
From: woan@exeter.austin.ibm.com (Ronald S. Woan)
Newsgroups: comp.lang.c
Subject: 'make' woes (won't catch secondary dependancy)
Date: 1 Oct 92 16:50:57 GMT
Reply-To: woan@cactus.org
Organization: Austin School of Hardknocks

In article <BvFB6o.A1w@news.cso.uiuc.edu> gbnewby@uxh.cso.uiuc.edu (Gregory B. Newby) writes:
>Greetings, wise ones.  I'm surprised that 'make' doesn't catch
>this problem, and would be very excited to hear of a good 
>solution or workaround.

Run makedepend (or whatever automated tool) to generate your
dependency list for you...
-- 
+-----All Views Expressed Are My Own And Are Not Necessarily Shared By------+
+------------------------------My Employer----------------------------------+
+ Ronald S. Woan                       woan@cactus.org or woan@vnet.ibm.com +
+ other email addresses             Prodigy: XTCR74A Compuserve: 73530,2537 +
From: scs@adam.mit.edu (Steve Summit)
Newsgroups: comp.lang.c
Subject: Re: unpredictable post-decrement behavior., also ++i = i++ ?
Date: 30 Sep 92 16:46:34 GMT
Article-I.D.: athena.1992Sep30.164634.7394
Organization: none, at the moment

In article <316@ulogic.UUCP>, hartman@ulogic.UUCP (Richard M. Hartman) writes:
>In article <28638@vedge.UUCP> michel@vedge.UUCP (Michel Trudeau) writes:
>>herzog@ux5.lbl.gov (Hanan M. Herzog) writes:
>>: See this:
>>: 	         product *= (double)(4 * n * n) / ((4 * n * n++) - 1);
>>: 
>>: Some compilers had no problem with this line at all. However some
>>: hurled completely upon sight of the 'n++'.
>>: Why did some compilers get and others not?
>>
>>   In 'C', unpredictable means undefined behavior.
> 
> The behavior for n++ is NOT undefined or unpredictible.

Begging Richard's pardon, the behavior of n++ in an expression
which contains other references to the value of n is formally
undefined, and hence unpredictable.

It's easy to have a mistaken assumption about the behavior of
postincrement (and postdecrement), which tends to lead to
an improper conclusion that these undefined expressions might
have predictable behavior.  This mistaken assumption is perfectly
illustrated in a later message of Richard's: in article
<323@ulogic.UUCP>, he writes:

> 	the prefix "++i" increments the variable then performs
> 		the rest of the statement;
> 	the postfix "i++" performs the rest of the statement then
> 		increments the variable.

These descriptions are misleading.  One cannot say with precision
when the increments (resp. decrements) performed by ++ (and --)
are performed, except that they must occur between the previous
and following sequence points.  ("Sequence point" is a term which
is precisely defined in the ANSI C Standard; for our purposes, it
is basically an edge of a simple statement or full expression.)
In particular, "i++" does *not* mean "fetch i's value, then
increment i, then proceed with the rest of the expression."
Since the increment can occur at any later time, prior to the
next sequence point, it's undefined what happens if other parts
of the expression also reference i.

See the comp.lang.c frequently-asked questions (FAQ) list for a
bit more information.

					Steve Summit
					scs@adam.mit.edu
From: dave@cs.arizona.edu (Dave Schaumann)
Newsgroups: comp.lang.c
Subject: Re: source code for POW function
Date: 2 Oct 92 07:23:36 GMT
Reply-To: dave@cs.arizona.edu (Dave Schaumann)
Organization: University of Arizona

In article <1992Oct1.091307.260@winkle.bhpese.oz.au>, clarke@winkle writes:
>Can anybody on the net supply me with a copy of the source code for the
>"POW" function.

Well, you could start out with

double pow( double x, double y ) { return exp( log(x) * y ) ; }

The "official" version of pow() is just that plus some special-case
stuff and error checking.

-- 
Dave Schaumann			dave@cs.arizona.edu
From: barmar@think.com (Barry Margolin)
Newsgroups: comp.lang.c
Subject: Re: Probably a simple realloc() question
Date: 1 Oct 1992 14:03:31 GMT
Organization: Thinking Machines Corporation, Cambridge MA, USA
NNTP-Posting-Host: telecaster.think.com

In article <1412@pacsoft.com> mike@pacsoft.com (Mike Stefanik) writes:
>In an article, steve@taumet.com (Steve Clamage) writes:
>>[...] If realloc cannot shrink the size, it should do nothing; it should
>>not attempt to make a smaller copy, for exactly the reason that it might
>>fail.  It is not reasonable to fail on being asked to do less than has
>>already been done. [...]
>
>I have an issue with this last sentence. Consider a single-tasking operating
>system with no VM. By forcing realloc() to always return successfully, the
>program does not know if the memory that it was using has *actually* been
>released. I could imagine that this would be an issue for "terminate and stay
>resident" programs and their ilk.

Realloc() is not the appropriate routine for such system-dependent programs
as TSR's to use.  On systems with flat address space, TSR's are usually
required to allocate their memory from the end of memory (so that regular
applications see a contiguous, but smaller, address space); on segmented
systems, they probably should allocate their own segment, to stay out of
the way of other applications.  I doubt there are many systems where
realloc() automatically does the right thing without some special hint
(otherwise, how would it even know that the application is a TSR and needs
the special memory handling?).

Indeed, on many systems free() doesn't return memory to the OS, it merely
makes the memory available for future malloc() calls in the same process.
The portable definitions of these routines are too vague to be useful when
you really care about the precise memory management behavior.

>IMHO, folks who write code like "chunk = realloc(chunk, small_buffer_size)"
>and never check what's returned (and squash the pointer to a valid block of
>core in the process) get exactly what they deserve.

No one is suggesting that you not check the result of the realloc(), merely
that if it fails it would be reasonable to complain to the vendor, since
there's obviously space available.  If the implementation has specific,
*documented* reasons for not returning the original pointer (perhaps the
program provided the aforementioned hint), then this suggestion is not
appropriate.

-- 
Barry Margolin
System Manager, Thinking Machines Corp.

barmar@think.com          {uunet,harvard}!think!barmar
From: Aurelius@cup.portal.com (Mark Christian Barnes)
Newsgroups: comp.lang.c
Subject: Re: Passing values and function pointers
Date: Mon, 28 Sep 92 23:32:45 PDT
Organization: The Portal System (TM)
Distribution: usa

rrooks@ecs.umass.edu (Raymond Rooks)  writes:

<terrible reference material deleted>

|  int function();
|  char *p;
|  p = (char *) function;
|
|so then I can then pass this pointer to the rtnewt.  The subroutine
|rtnewt has four arguments, the first being the pointer to the function,
|then three floats...which I guess is called like:
|
|rtnewt(p,x1,x2,xacc)  (where the last three are floats, not pointers to
|floats) 

 Yes, you need to use function prototypes to properly handle your
function call (or use K&R style function definitions). Notice that
the function pointer also *needs* the same parameter information.
Otherwise you'll be passing doubles to a function that expects
floats (but K&R style always passes doubles, c'est passe no?).

/* example */

typedef int (*rtnewt_TYPE)( float *, float, float, float );

int rtnewt ( float *p, float x1, float x2, float xacc ) { ... };

int main ( int argc, char &argv[] )
{
 rtnewt_TYPE pFunc = rtnewt;

 /* use function pointer */
 (*pFunc)( &1.0f, 2.0, 3.0, 4.0 );

 /* or ANSI allows */
 pFunc( &1.0f, 2.0, 3.0, 4.0 );
 return 1;
}

			Regards, Aurelius@cup.portal.com
Newsgroups: comp.lang.c
From: bmaslen@julian.uwo.ca (b.   maslen)
Subject: how do you use getpass() correctly
Organization: University of Western Ontario, London
Date: Thu, 1 Oct 1992 14:04:29 GMT


if I wanted to use getpass() to read in a password and not echo it to the screen, this is what I type BUT it does not work!!!


char answer[8];   defines answer an array of 8 characters

char password[] = { "hello" };  defines the password as being 'hello'

.
.
.

answer = getpass("Enter Password:  ");

this is supposed to read the entered password into answer and then an if statement tests to see if it is equal to the actual password (hello).

if ( strcmp(answer, password) == 0 )
   printf("password accepted");

this does not work for some reason.
if you know could you please inform me of my error.

Thanks in advance!!!!!

Bob Maslen


------------------------------------------------------------------------------
___   ____   ___
|  \ /    \  |  \
|  / |    |  |  /
---  |    |  ---
|  \ |    |  |  \
|  / \    /  |  /
---   ----   ---

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



Newsgroups: comp.lang.c
From: lastudil@dcc.uchile.cl (Luis Astudillo Vivar)
Subject: How can i delete the cursor from my C programs ??
Originator: lastudil@dcc.uchile.cl
Date: Tue, 06 Oct 1992 16:31:30 GMT
Organization: Universidad de Chile, Depto. de Ciencias de la Computacion

   Hi..
   How can i delete the cursor from my C programs?.
   I'm using curses library and i did not find the instruccion to do that.

   Someone can help me??

   Thanks in advance...

PD: Sorry for my bad english. :)

*****************************************************************************
*                                      *                                    *
*    _  /  _   Universidad de Chile    * Luis Astudillo Vivar (Esteban)     *
*    |  |  |   Escuela de Ingenieria   * E-mail: lastudil@dcc.uchile.cl     *
*    |  |  |                           *                                    *
*     \_|_/    Santiago, Chile         *              (1992)                *
*      /                               *                                    *
*****************************************************************************
Newsgroups: comp.lang.c