HDTenEightyP/NetNews huggingface dataset:
From: root@fincomp.raidernet.com (Neal McClain)
Subject: Re: The Correct Way To Write C if-Statements
Organization: Financial Computers Corp., Murfreesboro, TN
Date: Mon, 09 Nov 1992 15:09:55 GMT

My apologies to the group for posting a message that I meant to mail
to a friend.  Since my mail program uses 'f' to FORWARD and my newsreader
uses 'f' to post a FOLLOWUP I sometimes (well, this time, anyway) get 
them confused.  OOPS!

Oddly enough, nobody has flamed me on this yet.  I noticed it myself 
this morning when I saw my message staring me in the face.


Neal McClain               | Beam me up Scottie, there's no intelligent 
Murfreesboro, Tn           | life down here!   
root@fincomp.raidernet.com | uunet!mjbtn!fincomp!root
Newsgroups: comp.lang.c
From: mccall@mksol.dseg.ti.com (fred j mccall 575-3539)
Subject: Re: TC 2.0: unable to open include files
Organization: Texas Instruments Inc
Date: Tue, 10 Nov 1992 16:11:10 GMT

In <1992Nov9.230652.26156@sctc.com> glanton@sctc.com (John Glanton) writes:

>Has anyone run into this error.  I only get it with nested includes
>in \tc\include.  The files exist and are where one would expect them
>to be but TC can't open them.  For example, when including stdio.h
>I get this error when TC tries to open stdarg.h.

Have you told TC where to look for its include files?

-- 
"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.
Newsgroups: comp.lang.c
From: mouse@thunder.mcrcim.mcgill.edu (der Mouse)
Subject: Re: The Correct Way To Write C if-Statements
Organization: McGill Research Centre for Intelligent Machines
Date: Thu, 12 Nov 92 09:53:07 GMT

In article <1992Nov9.194915.1647@keinstr.uucp>, chaplin@keinstr.uucp (Roger Chaplin) writes:
> Mark Boolootian (booloo@framsparc.ocf.llnl.gov) wrote:
>> 		The Correct Way To Write C if-Statements
> [notes that 4-space indentation is used, and that the title is
> centered using tabs]
> Does Mr. Minton use the SPACE bar to indent his if statements??  He
> must not be using his TAB key.

It's reasonably likely that he uses an editor that deals with details
like code indentation automatically.  I use a C mode in an emacs
variant, and I rarely have to think about indentation; I just type
linefeed and { and } and emacs deals with getting it all lined up just
so and using mixed tabs and spaces for the indentation when necessary.

					der Mouse

			    mouse@larry.mcrcim.mcgill.edu
From: chuckb@stein.u.washington.edu (Charles Bass)
Newsgroups: comp.lang.c
Subject: Re: Macros
Date: 12 Nov 92 02:40:16 GMT
Article-I.D.: u.1992Nov12.024016.24895
Organization: University of Washington


After reading some of the posts it seems they slam macros and
generally for cases when users don't know how to use them
safely. It is hardly an argument against the pre-processor to
state that because it is difficult to use and has some caveats
and that beginners tend to abuse it (I still do) that it should
never be used.  With such arguments pointers and dynamic memory
allocation should also not be used either. ;-) 

I do use macros and have found them to be at times very
useful. It is difficult to believe that the pre-processor is of
absolutely no use.

I wonder if others who use macros might be interested in posting
how they use them and with what caveats.

Common uses I know of and use are: 

I)  avoiding function calls 
2)  simplifying complex expressions (bit operations are common)
3)  conditional code for debugging/platform changes
4)  common loop iterators (someone posted examples a while
back)

Any comments/flames gladly accepted!


Chuck Bass                             |
College of Forest-Systems Engineering  |
University of Washington               | FAX   (206)-685-3091
Mailstop AR-10                         | voice (206)-685-2198
Seattle,  WA  98195                    | email chuckb@u.washington.edu
From: ren@function.mps.ohio-state.edu (Liming Ren)
Newsgroups: comp.lang.c
Subject: gcc and cc!
Date: 5 Nov 1992 23:56:02 -0500
Organization: Department of Mathematics, The Ohio State University
Distribution: world
NNTP-Posting-Host: function.mps.ohio-state.edu



It seems to me that if we have two object file , say foo.o and bar.o,
one is compiled with gcc and the other with cc, then we can't link them 
together such as 

cc foo.o bar.o -o name

or

gcc foo.o bar.o -o name


I learned it in a hard way and still confused. Could some experts
say more about this.


Thanks!
Newsgroups: comp.lang.c
From: tstead@cs.umr.edu (Tim Steadham)
Subject: Numerical programs needed
 I am working on a project right now, and i have come across a minor
Date: Tue, 10 Nov 1992 03:34:15 GMT
Organization: University of Missouri - Rolla
Originator: tstead@mcs213f.cs.umr.edu
From: achoi@soda.berkeley.edu (Andrew Choi)
Newsgroups: comp.lang.c
Subject: How does the Address-of Operator (&) really work?
Date: 12 Nov 1992 00:46:53 GMT
Organization: U.C. Berkeley, CS Undergraduate Association
Distribution: world
NNTP-Posting-Host: soda.berkeley.edu

Hi netters:

  I was told that the address-of operator & (along with sizeof)
is done at compilation done, therefore, it becomes legal to
do the followings:

  &(((struct S *) NULL)->field)

However, what I don't understand is how it works under multiple
files.  Considered the followings:

  /* file "foo.c" */

  char *a = "This is a test";

  /* file "bar.c" */

  char **b = &a;	/* note that char *b = a; is ILLEGAL */

When the 2 files, "bar.c" and "foo.c" are separately compiled,
what does the compiler put for "&a", since it does not know where
the definition for "a" is?

  Also, I need a definitive bible to the C language.  What book(s)
are considered to be the bible for the C language?

-- Andrew

From: eperez@hpprdeb.HP.COM (Edgar Perez)
Date: Mon, 2 Nov 1992 12:39:34 GMT
Subject: Re: Style Guides and Portability Guides
Organization: HP Puerto Rico Manufacturing Operation
Newsgroups: comp.lang.c

In comp.lang.c, jcurtis@seqp4.sequoia.com (John Curtis) writes:

>Are there any relatively simple C style guides available,
>either online or in favorite texts?

You may want to try this book:

Title: C Style, Standards and Guidelines
Author: David Straker
Publisher: Prentice-Hall
Date of publication: 1992
Pages: 231
ISBN: 0-13-116898-3

I dont have the book, so I can't comment on it (Though other people like it).

Edgar

   _________________________________________________________________________
  |                 ___                                                     |
  |                /  /                             Edgar Perez             |
  |        HEWLETT/hp/PACKARD            New Process Technology Engineering |
  |              /__/                         eperez@hpprdos.prd.hp.com     |
  |Puerto Rico Manufacturing Operation           Telnet: 882-6538           |
  |_________________________________________________________________________|
From: Jack.Doff@f262.n633.z3.fidonet.org (Jack Doff)
Newsgroups: comp.lang.c
Subject: Multidimensional Arrays A
Date: Tue, 03 Nov 1992 19:15:00 +1100

On the topic of how to pass multi-dimensional arrays, last time I needed
to do it, I simply put the lines:

void foobar( array2d[10][10])
{ etc...

And it worked fine, and still does...

Have a better one,
        Curt Slanger

  SLMR 2.1a  You send it, I'll read it!
 * Origin: The Infinity Links BBS  (3:633/262)
From: scjones@thor.sdrc.com (Larry Jones)
Newsgroups: comp.lang.c
Subject: Re: Returned struct
Date: 6 Nov 92 15:32:00 GMT

In article <1992Nov5.075611.14809@piccolo.cit.cornell.edu>, sl14@crux3.cit.cornell.edu (Stephen Lee) writes:
> How can one make use of a struct returned by a function?  e.g.
> 
> struct complex complex_add(struct complex a, struct complex b);
> 
> I tried
> 
> struct complex z1, z2, z3;
> z3 = complex_add(z1, z2);

That appears to be correct.  Did you actually have a declaration of
complex_add before the call?  If not, the compiler would assume that
it returned an int rather than a struct and would complain about
trying to assign an int to a struct.
----
Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH  45150-2789  513-576-2070
larry.jones@sdrc.com  or  ...uunet!sdrc!larry.jones
We don't ATTEND parties, we just CRASH 'em. -- Calvin
From: gegu@zurich.spectrospin.ch (Gerry Gucher)
Newsgroups: comp.lang.c
Subject: Re: How to use 'return' in c?
Summary: boolean != int
Date: 9 Nov 92 20:12:24 GMT
Organization: Spectrospin AG, Fallanden Switzerland

In article <1992Nov7.122126.24409@druid.uucp>, darcy@druid.uucp (D'Arcy J.M. Cain) writes:
> allebrandi@ipact.com writes:
> >The best thing to do is to use manifest constants to implicitly document
> >the value you are returning. For example, return TRUE or FALSE not 1 or
> >0 for a boolean function return.

> 
> Whenever I see TRUE and FALSE in code I am maintaining I remove the
> #defines.  If they are defined, they should never be anything but
> TRUE = 1 and FALSE = 0.  Anything else is confusing and misleading.
> Given this why force the maintainer to go searching for the definitions
> to make sure that they are what they should never be anything but?
> This isn't as bad as #defining SEVEN as 7 but it is in the same category
> I think.


Sorry, I think your thinking is wrong.

TRUE and FALSE are the values for a boolean type. A boolean is a
logical concept that can yield TRUE or FALSE.

An integer on the other hand is a numerical value
that ranges (on my machine) from 2^31 -1 down to -2^31 which 
yields 2^32 values.

Note quite the same, is it ?

Even if these stupid machines called computer (and C compilers) 
*represent* them identically, they are still not the same thing.

#define SEVEN 7        /* is of course bull..it as well as is */
#define FORMFEED  '\f' 

Gerry


+------------------------------------------------------------------+
| Gerry Gucher                             gegu@spectrospin.ch	   |
| Spectrospin AG,  Industriestr 26,  8117  Faellanden Switzerland  | 
+------------------------------------------------------------------+
| A program that  returns the  wrong | There is nothing wrong with |
| result twice as fast is infinitely | making  mistakes,  but make |
| slower.               - H. Spencer | new ones.           - D.Sim |	
+------------------------------------------------------------------+
Newsgroups: comp.lang.c
From: bandy@netnews.jhuapl.edu (Mike Bandy)
Subject: Re: ld: Undefined symbol Problem.
Organization: JHU/Applied Physics Laboratory
Date: Wed, 11 Nov 1992 17:32:32 GMT

hiren@teknetix.com (Hiren Shah) writes:

> 
>Hi:
> 
>I am trying to "make" a program and foll. are the errors that I get:
> 
>ld: Undefined symbol
>   _sin
>   _cos
>   _pow
>   _floor
>   _get_wmShellWidgetClass
>   _get_applicationShellWidgetClass
>   _dlopen
>   _dlclose
>   _dlsym
>*** Error code 2
>make: Fatal error: Command failed for target `xdbx'
> 
> 
>I assume that one/two of the libraries are broken(one of them
>probably being the math library ...)
> 
>Can I just ftp the libraries fromn somewhere or do I have to get the
>compiler. ?  Or is there someway to fix it ?

Before you try to help out your system manager, what's the command you're 
using to build your application?  Did you forget to include the math
library?  Looks like maybe the X library should be referenced too, but I don't
know offhand what it's name is.

   cc myprog.c -lm
               ^^^

>Any suggestions will be appreciated.
> 
>Thanks
> 
>Hiren
> 
>hiren@teksun.teknetix.com
-- 

	Mike Bandy
	bandy@aplcomm.jhuapl.edu
	Johns Hopkins University / Applied Physics Lab
Newsgroups: comp.lang.c,comp.lang.fortran,comp.unix.programmer,comp.os.msdos.programmer,comp.sys.ibm.pc.misc
From: emmerik@utrcu1.civ.utwente.nl (Emmerik P.J.L. van)
Subject: Anyone with experience porting from UNIX/X11 to MSDOS??
Followup-To: comp.os.msdos.programmer
Keywords: porting, unix, X11, msdos
Organization: University of Twente
Date: Sat, 7 Nov 1992 21:10:19 GMT

Anyone out there with experience in porting UNIX/X11 applications to
MSDOS?

We are investigating the possibility of porting a rather big UNIX/X11
application (about 25 Mb source) written in FORTRAN and C to MSDOS.
The reason we want to port to MSDOS is that a lot of people have a PC
that is adequate for our application, but the do not want to leave
MSDOS becouse of existing applications, or they do not want to learn
a new OS like for example UNIX.

What dit you do about the following problems:
- Limited file name lengths
  The development will continue on UNIX, so for sources i would not mind
  to convert file names automatically.
- Memory - UNIX has an "unlimited" virtual memory space for every proces
  Are there compilers or other methods to have an "unlimited" address
  space under MSDOS (or maybe Windows NT) ?
- Can linkers under MSDOS handle long routine names
  Our routines are unique within 9 characters.
- Can you combine C and FORTRAN code the same way you do under UNIX
  i.e. trailing underscore and extra parameters for stringlenths for
  FORTRAN routines
  Note: we could prevent the problem of combinig C and FORTRAN by converting
  our FORTRAN code to C using F2C.
- What dit you do about graphics, we currently use X11

Other things I would like to know are:
- What compilers and utilities dit you use
- Where can they be obtained (reps in The Netherlands or elsewhere in Europe)
_ What was the approximate cost

Are there any problems i dit not mention that i should think of?

Please E-mail to emmerik@utwente.nl

-- 
Pieter van Emmerik                    | Phone:  +31-74-464231
HDS info management                   | FAX:    +31-74-464110
P.O.box 23                            | E-mail: emmerik@utwente.nl
7550 AA  Hengelo, The Netherlands     |         hp4nl!utrcu1!emmerik
Newsgroups: comp.lang.c
From: jrv@truth.mitre.org (Van Zandt)
Subject: Re: Line drawing algorithm
Keywords: C, graphics, line
Organization: The MITRE Corp., Bedford, Ma.
Date: Thu, 5 Nov 1992 17:25:22 GMT

In article <1992Nov4.170128.14526@inmet.camb.inmet.com> richw@sol.camb.inmet.com (Richard Wagner) writes:
>Bresenham's algorithm is a classic in the graphics world.  

What's an efficient way to draw a (best approximation of a) line of specified
width?  Corners are especially awkward.


Newsgroups: comp.lang.c
From: dave@gctech.co.jp (Dave)
Subject: How to broadcast messages to processes?
Organization: GC Technology
Distribution: comp
Date: Thu, 12 Nov 1992 12:24:34 GMT

Howdy net,

I'm trying to set up a package where processes (compiled C programs) can
send each other public messages.  I've been studying my RISC/os
Programmer's Guide, and have got through messages and pipes, and so far it
looks like there aren't any real broadcast tools.

I mean, when you set up a pipe or a message queue, you can make it so that
any process can read it.  But when a single process reads the queue, that
amount of read info goes away, and other processes won't be able to read
it.  At least, that's what I gathered from the manual.

What I want to do is have a mesage readable by all processes, as many
times as they want.  I only want messages to get deleted when the channel
goes away.

I figured that I could do this with message queues by having the reading
process re-send the exact same message it just read, so that it is in
effect not removed from the queue.  But this has the problem that there is
a finite amount of time between the read and the re-post in which the
message does not exist on the queue.  And my hawkish little processes are
sure to get hung up on that delay.

Can somebody point me in a broadcast direction?

TIA,
Dave
----
David Wuertele, GC Technologies, Algorithm Research
dave@gctech.co.jp	dave@windsor.iis.u-tokyo.ac.jp
From: mouse@thunder.mcrcim.mcgill.edu (der Mouse)
Newsgroups: comp.lang.c
Subject: Re: need to create a jump table
Date: 12 Nov 92 09:36:39 GMT
Article-I.D.: thunder.1992Nov12.093639.19500
Organization: McGill Research Centre for Intelligent Machines

In article <1992Nov3.025210.27336@ryn.mro4.dec.com>, uyeno@subsys.enet.dec.com (Alice Uyeno) writes:

[Just a note: it's generally a good idea to break your lines somewhere
around column 75 or so; lines of five or six hundred characters do tend
to impair readability.]

> I'm trying to develop a jump table.  I'm wondering if it is possible
> to have the functions with varying number of parameters.  For
> example, if my jump table contains pointers to ErrorRoutine and
> ValidateCmd, where the prototypes for the routines are as follows:

> 	void ErrorRoutine(int *ErrCode, struct foo * MyPtr);
>         void ValidateCmd(struct foo * CmdPtr);

> void (* FcnTbl[])() = {ErrorRoutine,ValidateCmd};

This is possible, though you have to cast the initializer values.  Note
also that you must cast the value back to its initial type before
calling through it - which implies that you have to determine what that
type is somehow.  However, you have to know that anyway in order to
make the call.

					der Mouse

			    mouse@larry.mcrcim.mcgill.edu
Newsgroups: comp.lang.c
From: bandy@netnews.jhuapl.edu (Mike Bandy)
Subject: Re: To Recurse or NOT to recurse?
Organization: JHU/Applied Physics Laboratory
Date: Wed, 11 Nov 1992 17:13:50 GMT

ps@cs.strath.ac.uk (Paul Shaw) writes:

>In article <4223@litchi.bbn.com> cbarber@bbn.com (Chris Barber) writes:
>>In article <1992Nov6.185136.8055@netcom.com> sjs@netcom.com 
>>(Stephen Schow) writes:
>>
>>Recursion should usually be avoided in C for reasons of efficiency.  A
>>recursive linked-list traversal will require much greater overhead both for
>>CPU cycles (because of the instructions needed to make function calls) and
>>storage space (because of the use of the stack) than a while-loop traversal.
>>

>I'd just like to give a view which most people seem to disagree with here.
>I find that it is _always_ better to use recursion for traversing
>recursive data structures (at least in the first development cycle).

I wholeheartedly agree.  The mechanics of recursion save a bunch of
headaches that the programmer must take care of manually.  Also, if the
stack space is too big, then you're probably passing too much down to the
lower levels.  I often program 2 routines, the first will set up global vars
with whatever the recursive routine needs to know for the whole search, like
match criteria; then the second whips through the data structures calling 
itself with a minimum of info.

>>This advice does not apply to code written in Lisp and other languages that
>>optimize tail-recursion.

>Many C compilers will optimize tail recursion to an iterative loop.

I've used C on a few platforms and have never seen an optimization that
converts recursion to anything but an optimized recursion.  What you're 
saying is that the optimizer will replace user-defined function calls
with in-line code.  Can someone give an example of a compiler (and perhaps 
some code) that verifies this?

AI-101 class often has an assignment that takes a LISP procedure as input,
determines that it does tail-recursion, converts it into a looping procedure,
then calls it.  Given that LISP functions look exactly like LISP data, 
it's not a big deal -- not the case in C.

>>-- 
>>Christopher Barber
>>(cbarber@bbn.com)

>Paul Shaw,
>Dept of Computer Science,
>University of Strathclyde,
>Glasgow.
-- 

	Mike Bandy
	bandy@aplcomm.jhuapl.edu
	Johns Hopkins University / Applied Physics Lab
From: cc015@cleveland.Freenet.Edu (Vito T. Kwan)
Newsgroups: comp.lang.c
Subject: qucik, merge, shell and bubble sort
Date: 13 Nov 1992 23:11:59 GMT
Organization: Case Western Reserve University, Cleveland, Ohio (USA)
NNTP-Posting-Host: hela.ins.cwru.edu


Hi all,
	I want to take a look at these four sorting method in C, does anyone
know where can I get (ftp) them?
	Thankss in advance
-- 
Vito Kwan                 
Academic Computer Center,   Hofstra University
INTERNET:   accvtk@vaxc.hofstra.edu
BITNET  :   csc3vtk@hofstra.bitnet
Newsgroups: comp.lang.c
From: msb@sq.sq.com (Mark Brader)
Subject: Re: Typedefing builtin... thanks.
Organization: SoftQuad Inc., Toronto, Canada
Date: Wed, 11 Nov 92 06:18:12 GMT

> The major arguments used to justify these techniques were about portability.
> A program is easier to port, when you can change some typedefs in a header
> file, instead of changing a lot of ints to longs all over the code.

There are good reasons for typedefs, but this is not one of them.
If the code was correctly written, those ints would have been longs
in the first place.  See item 10.1 in the FAQ list.
-- 
Mark Brader, SoftQuad Inc., Toronto	"Constrain your data early and often."
utzoo!sq!msb, msb@sq.com		 	-- C. M. Sperberg-McQueen

This article is in the public domain.
Organization: University of Illinois at Chicago
Date: Wednesday, 11 Nov 1992 21:32:38 CST
From: <U17868@uicvm.uic.edu>
Newsgroups: comp.lang.c
Subject: problem with foef()

i
I am reading a binary file with fread. The file has only two records each of si
ze 193 bytes. The problem is that after reading the second record (structure) t
he feof function does not detects the end of file and goes through the loop one
 more time (third time). I check with the ftell fucntion the position of the
file_pointer (pointer to the file that I am reading). First time it gives the p
osition at 193 i.e after reading the first record. Second time it shows the pos
ition of the file_pointer at 386 which is correct. Now, I don't have any more r
ecords in the file. But, it goes again and reads the same last record again. Th
e position of the file_pointer is still 386. After reading the same record, feo
f detects the end of file and returns.  any suggestions
thanks in advance
u17868@uicvm.cc.uic.edu
sikander
 my program is listed below

#include "header.h"
void dispdail(date)
char date[9];
{
int i,j, a;
FILE *file_pointer;
struct activity temp;
 file_pointer = fopen("activity.dat","rb");
 fseek(file_pointer,0,0);

       while(!feof(file_pointer))
  {
    fread(&temp, sizeof(temp),1,file_pointer);
    j = strcmp(date,temp.date);
    if(j == 0)
        printf("%s",temp.date);

     if(a = (feof(file_pointer)) != 0)
        {
         fclose(file_pointer);
         return;
        }
  }/* end while */

}   /* end dispdail */
Newsgroups: comp.lang.c
From: zap@hopi.eel.ufl.edu (Tom Grein)
Subject: What are linked-lists and how to use them 
Keywords: link list
Organization: University of Florida
Date: Mon, 9 Nov 92 17:42:07 GMT


I am not new to C programming, however; I have never used a linked list.  I was wondering if there are FAQ files on the subject.

If there are no FAQ files, are there any books that include linked-lists in them. If not that, then someone could e-mail me a good explination if they like.
 
Tom G.



Newsgroups: comp.lang.c
From: hiren@teknetix.com (Hiren Shah)
Subject: ld: Undefined symbol Problem.
Organization: Teknetix
Date: Tue, 10 Nov 1992 21:15:44 GMT

 
Hi:
 
I am trying to "make" a program and foll. are the errors that I get:
 
ld: Undefined symbol
   _sin
   _cos
   _pow
   _floor
   _get_wmShellWidgetClass
   _get_applicationShellWidgetClass
   _dlopen
   _dlclose
   _dlsym
*** Error code 2
make: Fatal error: Command failed for target `xdbx'
 
 
I assume that one/two of the libraries are broken(one of them
probably being the math library ...)
 
Can I just ftp the libraries fromn somewhere or do I have to get the
compiler. ?  Or is there someway to fix it ?
 

Any suggestions will be appreciated.
 
Thanks
 
Hiren
 
hiren@teksun.teknetix.com