HDTenEightyP/NetNews huggingface dataset:
From: ctaylor@sparc7.cs.uiuc.edu (Conrad W Taylor)
Subject: Linked list of strings...?
Organization: University of Illinois at Urbana-Champaign
Date: Thu, 8 Oct 1992 02:06:44 GMT



         How would one create a linked list of strings that has
two operations insert and print?  I having problems inserting
info into the linked list.  Meaning, I need help with an insert
routine.  Thanks  to all that reply to this post.

-Conrad

ps: My e-mail is ctaylor@silver.lcs.mit.edu or
    u21749@uicvm.uic.edu.


Newsgroups: comp.lang.c
From: joec@fid.morgan.com (Joe Collins)
Subject: Help - what is wrong?
Organization: None
Date: Fri, 16 Oct 1992 15:54:35 GMT

Machine: IBM 386 25Mhz, Compiler: Turbo C v3.0, with Ansi option activated

I am learning C and have a compile problem I cannot figure out:

The code fragment:
----------------------------------------------------------------
#include <stdlib.h>
#include <stdio.h>
#include <malloc.h>

#define HOWMANY 100

typedef struct block{
  unsigned long index;
  unsigned long date;
  unsigned long size;
  unsigned long pathnum;
  char attrib;
  char filename[13];
} record;

main(void){

 struct ffblk f;
 char attrib;
 unsigned long space,idx,i,j;
 record *address;
 space=HOWMANY*sizeof(record);
 address=(record *)malloc(space);  /*ERROR MESSAGE HERE*/
 for(idx=0;idx!=5;idx++){
   r=&address[idx];                /*AND HERE*/
   };
}

----------------------------------------------------------------
The error messages are:

    CONVERSION MAY LOSE SIGNIFICANT DIGITS

What am I doing wrong? I looked in FAQ and couldn't find any
hints in there. 

Thanks in advance!

Joe
joec@morgan.com
From: hartman@ulogic.UUCP (Richard M. Hartman)
Newsgroups: comp.lang.c
Subject: Re: NO NUMBERS! (or even SHORT INTS!)
Date: 8 Oct 92 17:34:31 GMT
Organization: negligable

>The moral (for me, anyway): use *real* symbolic names where they make sense to
>hide "magic numbers", and not just for the sake of following a rule.

"ONE" (or "TWELVE") is not a symbolic name.  He wasn't following the rule.
(whether he thought he was or not)

			-Richard Hartman
			hartman@uLogic.COM

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
I think.  I think I am.  Therefore ... I *am*!  (I think....)
From: barmar@think.com (Barry Margolin)
Newsgroups: comp.lang.c
Subject: Re: Lookup table location
Date: 16 Oct 1992 15:01:37 GMT
Organization: Thinking Machines Corporation, Cambridge MA, USA
NNTP-Posting-Host: telecaster.think.com

In article <455@ulogic.UUCP> hartman@ulogic.UUCP (Richard M. Hartman) writes:
>In article <1bf19uINNb2t@early-bird.think.com> barmar@think.com (Barry Margolin) writes:
>>You can declare the variable with "static const char *days[] = ...", and
>>prototype the function "const char *dayname(int day)".  The caller will be
>>forced to use a "const char *" variable to hold the result (unless he
>>explicitly casts the result to a non-const).
>
>1) is there anything wrong with this?  I've always thought it was bad
>   practice to "cast away" const-ness, it could cause trouble later
>   on if you try to change the data....  what is wrong w/
>
>    const char *answer = dayname(3);	

This isn't legal C, since an initializer must be a constant expression, and
a function call is never a constant expression (it would be valid in C++,
which doesn't have this restriction).

>and how would:
>
>    char *answer = (char *) dayname(3);
>
>be any more helpful/useful(/safer(?!??!))

It's *not* more helpful/useful/safer.  As you said, it's a bad idea to cast
away const-ness.  I wasn't endorsing it, just acknowledging that callers of
such a function could still get around its protections.  However, they have
to make that intention explicit by the use of a cast, and they therefore
take full responsibility for any errors that result.  As the library author
you've done all you could by specifying your function to return a const
char*.
-- 
Barry Margolin
System Manager, Thinking Machines Corp.

barmar@think.com          {uunet,harvard}!think!barmar
From: ajay@acsu.buffalo.edu (Ajay Shekhawat)
Newsgroups: comp.lang.c
Subject: Re: C-formattors (problems with very long lines)
Date: 12 Oct 92 20:45:15 GMT
Organization: University at Buffalo, Dept. of Computer Science

simonm@mel.dit.csiro.au (Simon McClenahan) writes:
: 
: 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.

I'm trying to use GNU's indent to format a huge  C file, but it doesn't seem to
fold lines. The source that I'm looking at has some lines which are much
longer than 80 characters; is there an option to (gnu)indent which will
make it fold source lines (not just comments) ? I tried -l75, but 
got nowhere...

I have the latest version of (gnu)indent(1.6).  Any help will be appreciated.

Ajay

ajay@cs.Buffalo.EDU
From: dave@cs.arizona.edu (Dave Schaumann)
Newsgroups: comp.lang.c
Subject: Re: Upper and lower case in names: where use which ?
Keywords: define, typedef
Date: 11 Oct 92 06:02:44 GMT
Reply-To: dave@cs.arizona.edu (Dave Schaumann)
Organization: University of Arizona

In article <zembrod.718621535@kuba.informatik.uni-freiburg.de>, zembrod@informatik (Philip Zembrod) writes:
>I'm wondering about the habit of giving upper case names to new types
>created with typedef. I used to do it and ran into trouble some day because
>a preprocessor macro changed part of a type name. Something like
>
>#define FOO 77
>
>typedef struct foobar {
>  int a;
>  char b[FOO];
>} FOOBAR;
   ^^^^^^
If your macro-processor changes this because of the #define FOO, it is
broken.  The recognition of macro names is strictly token-based.

As to your other question:

>So what advantages does it have to use upper case names with typedef ?
>And where does this habit come from ?

Naming conventions are used as program mnemonics -- ie, the structure
of the name helps you to remember the structure of what it refers to.
Personally, I prefer the convention

typdef struct FOOBAR {
  /* whatever */
  } foobar_t ;

Since there is no reason to use a macro for a struct/union/enum name,
there is less potential for confusion in using upper-case for it.  Of
course, since type name space is seperate from struct/union/enum name
space, I could use the same name in both places:

typedef struct foobar_t {
  /* whatever */
  } foobar_t ;

This is probably preferrable, but I'm in the habit of using the former
style, and I don't see any particular reason to switch now.  Ultimately
what's important is to develop naming conventions that help you to
remember what things do and what they are called.  Good naming conventions
can be an invaluable aid to writing programs.

-- 
Dave Schaumann			dave@cs.arizona.edu
Newsgroups: comp.lang.c
From: cga66@cbnewse.cb.att.com (patrick.v.kauffold)
Subject: Estimating (was Productivity of a C programmer )
Organization: AT&T
Date: Tue, 13 Oct 1992 18:00:48 GMT

There seems to be general agreement that sofware development projects are 
not estimated very well.  Maybe this is a PROCESS problem.

Consider, for example, the construction industry.  In spite of some
notable failures (chunnel), for the most part, profitable construction
companies have developed an approach (process) that works for them.

The most glaring difference, it seems to me, is that they have people
whose PRIMARY job is estimating.  These folks develop expertise at
estimating, collecting data, maintaining organized rules, training
newcomers.

In addition, these estimators are held accountable for their estimates.
Most construction companies work to fixed price contract, with 
penalties for late completion and overruns.

They are favored with a fairly stable environment in terms of the 
components, which are highly standardized and well-understood.

Most software shops have not evolved this far.  Very few have people
who are dedicated to estimating; estimates are done ad-hoc, usually 
by development people, for "free". It is rare that data is collected
which would help to estimate future projects (another "free" activity).

Estimates often happen in a "political" mode.  How long will this
take?  Answer: 6 months.  Response: That's too long.  Suppose you
only did the bare-bones, then how long?  Answer: 5 months. (repeat
the preceding steps until the manager gets the answer he/she wants
to hear). Negotiating estimates is common; it is like saying "Please
lie to me."

I note in Yourdon's latest book that he labels as "immature" the
belief on the part of managers that "software is free"; to that 
I would add that it is immature to expect that estimates are free.

If you estimates are bad, they you have a bad estimating PROCESS.
How to fix the process is beyond the scope of these rantings.
Newsgroups: comp.lang.c
Newsgroups: comp.lang.c
Subject: Linker Error???
From: cbarilleaux@miavx1.acs.muohio.edu (Cyberpreppie)
Date: 9 Oct 92 10:53:24 -0500
Organization: The CyberSwamp

	I don't know if this is pertinate to the discussion of this group, as
it deals with a compiler rather than a language. I just started reading this
group, and lack the FAQ. If it is, I apologize (don't flame me *too* much).
	I use Turbo C++ v 3.0 as my compiler. Sometimes, when I compile,
especially graphics routines, I get a linker error: "Unkown sybmol _main in
modual C0.ASM" Has anyone else edver gotten this error? How is it solved? What
does it mean.
	Any help is appreciated.
	Thanks
-----------------------------------------------------------------------------
I. Charles Barilleaux III                 occasionally know at Miami Univ
CBARILLEAUX@MIAVX1.ACS.MUOHIO.EDU         as Cyberpreppie.

Two wrongs don't make a right, but three lefts do.

Newsgroups: comp.lang.c
From: zembrod@informatik.uni-freiburg.de (Philip Zembrod)
Subject: Upper and lower case in names: where use which ?
Keywords: define, typedef
Organization: Institut fuer Informatik der Universitaet Freiburg, Deutschland
Date: Fri, 9 Oct 92 09:14:31 GMT

I'm wondering about the habit of giving upper case names to new types
created with typedef. I used to do it and ran into trouble some day because
a preprocessor macro changed part of a type name. Something like

#define FOO 77

typedef struct foobar {
  int a;
  char b[FOO];
} FOOBAR;

So what advantages does it have to use upper case names with typedef ?
And where does this habit come from ?

Philip


--
: whoisit?  ( -- )
 ." Philip Zembrod "  ( zembrod@informatik.uni-freiburg.de ) ;
Newsgroups: comp.lang.c
From: meattle@usc.edu (Saumya Meattle)
Newsgroups: comp.lang.c
Subject: Graphics Stuff
Date: 15 Oct 1992 01:20:22 -0700
Organization: University of Southern California, Los Angeles, CA
Distribution: usa
NNTP-Posting-Host: aludra.usc.edu


I need to get hold of source code in C for garphics stuff such as filling
polygons, drawing lines, scaling, transforming etc.

What is the best place to get it?

Thanks.

Saumya Meattle
meattle@aludra.usc.edu

Ps. Please reply by private email: No sense in wasting net recources......

Newsgroups: comp.lang.c,comp.software-eng,comp.sys.mac.programmer
From: dkeisen@leland.Stanford.EDU (Dave Eisen)
Subject: Re: Productivity of a C programmer ?
Organization: Sequoia Peripherals, Inc.
Date: Sat, 17 Oct 92 03:58:09 GMT

In article <1992Oct16.201047.21993@tcsi.com> miket@hermes.tcs.com (Michael Turner nmscore Assoc.) writes:
>
>I realize this process begs some questions.  For example, how do you
>estimate design time?  You can't--so don't even try.  AND DON'T PRETEND
>TO THE CUSTOMER THAT YOU CAN!  Go in small steps, getting paid as you go.
>There are excellent political reasons for being incremental on both
>sides at this stage anyway.

While you make some good suggestions on the estimation process, they
all sound like you work in a programming environment *very* different
from the one I work in. And that your methods just aren't reasonable
when taken out of that environment.

Get paid as you go? A customer pays you to do a detailed design before
you have even given him an estimate? Maybe you work on government
contracts. Or maybe most companies have different relationships with
their customers than we do.

I'm usually asked to give my estimates *before* the customer even
knows we exist. I have to give some rough idea of what a project
will cost us to our salespeople so they know what kind of proposal
to prepare. And as nice as it would be to have a detailed design
of the project in mind when I give these estimates, I wouldn't have
time to do much of anything else if I drew up a solid design for every
contract we made a bid on. Besides, our company can't afford to have 
me doing that much work on the pass line.

My estimates are usually glorified guesses based on other projects
we've done of a similar size and complexity. They come out close
enough for us to still be in business. But there really is no
way (or at least none that I've thought of) for me to give estimates
that I can guarantee to even an order of magnitude.

I'd be very interested in hearing anything you could suggest that
would be relevant to a programmer at a company like mine. Really.



-- 
Dave Eisen    dkeisen@leland.Stanford.EDU   Sequoia Peripherals: (415) 967-5644
      Incompetent amateurs have given prostitution a bad name.
        --- Camille Paglia in "Madonna II: Venus of the Radio Waves"
From: Jan.Wieck@f1.n100.z60.wlink.nl (Jan Wieck)
Newsgroups: comp.lang.c
Subject: TC++ 1.0 spawn() question.
Date: Mon, 12 Oct 1992 23:38:09 -0100

Organization: Private Site under Mach386

From article <nhu1H8ug2a@atlantis.psu.edu>, by newton@wilbur.psu.edu (Cynthia Newton):
> 
> [...]
> 
> spawnvp(P_WAIT,"test.exe",NULL); <-works if the location is in PATH
> spawnvp(P_WAIT,"C:\TEST\TEST.EXE",NULL) <-does not work, perror says
		    ^^
		    ||

This is a single 'T'. You just quoted it. Better write
... "C:\\TEST\\TEST.EXE" ... to get what you want.


Until later, Jan


-- 
# Any language keeps its own misunderstandings; #
# why shouldn't programming languages do?       #
#                                               #
#            wieck@jwminhh.hanse.de (Jan Wieck) #
From: mikef@dcs.ed.ac.uk (Mike Fourman)
Newsgroups: comp.lang.c
Subject: Re: What should we do here?
Date: 16 Oct 92 23:53:42 GMT
Reply-To: mikef@dcs.ed.ac.uk (Mike Fourman)
Organization: Laboratory for the Foundations of Computer Science, Edinburgh U

In article <3684@dozo.and.nl> jos@and.nl (Jos Horsmeier) writes:
>In article <Bw7szz.4J4@dcs.ed.ac.uk> mikef@dcs.ed.ac.uk (Mike Fourman) writes:
[my article criticising some traffic in comp.lang.c quoted in full, 
 including the following line]
>|Apart from that, its become a waste of time.
and the rebuke:
>I'm sorry for saying so, but I find this quite insulting towards 
>Mr. Summit, Volpe, Mangolin, Winzenius and many others who are
>always kind and friendly enough to explain even the simplest problems
>one may encounter when using the C programming language. 

My point was badly made. I did not intend to slur these paragons.
My gripe was that the noise level in the group was (is) too great.

So far, this article is just more noise. To put that right, here are
two examples of queries I would expect in this group:

When should I use #define and when should I use const?
Since there is a type char, why does getchar return an int?



--
Prof. Michael P. Fourman                     email        mikef@dcs.ed.ac.uk
Dept. of Computer Science                    'PHONE (+44) (0)31-650 5198 (sec)
JCMB, King's Buildings, Mayfield Road,              (+44) (0)31-650 5197
Edinburgh EH9 3JZ, Scotland, UK                 FAX (+44) (0)31 667 7209
Newsgroups: comp.lang.c
From: icsg0131@cs.montana.edu (Jeff)
Subject: Re: Problem with TC 2.0
Organization: Montana State University, College of Engineering
Date: Fri, 16 Oct 1992 02:07:25 GMT

In article <1992Oct16.003104.11323@qualcomm.com> gbrand@qualcom.qualcomm.com (Graham Brand) writes:
>   _main not found in module C0S

Make sure you have a main() function and take out the NONAME.C from the
Primary file option on the Compile menu.  You can do this from TCINST but
if you've already installed it you need to do it from the TC IDE.
From: hartman@ulogic.UUCP (Richard M. Hartman)
Newsgroups: comp.lang.c
Subject: Re: Union-initialization portability
Date: 8 Oct 92 19:03:08 GMT
Article-I.D.: ulogic.401
Organization: negligable

You are right, this relies upon knowing that the bit representation
for the two values you use are proper.

In the case I had to do this in pascal I was attempting to create
a pointer to a hardware dependant place in memory, and there was
no way to do this in the pascal I was using, so I made a union 
(variant record) w/ an int and a pointer, set the int value and
used the pointer.  This works because the int & the pointer had
a common bit-representation.  If you try to go from int to float
this way you're definately going to be in trouble.

		-Richard Hartman
		hartman@ulogic.COM

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Smoke me a kipper, I'll be back for breakfast!"
Newsgroups: comp.lang.c
From: farrell@fjord.reo.dec.com (John M. Farrell)
Subject: Re: Incomplete structure declarations: only within structs?
Organization: Digital Equipment Corporation - UK Engineering
Date: Thu, 8 Oct 1992 11:40:20 GMT

In article <26701@dog.ee.lbl.gov> torek@horse.ee.lbl.gov (Chris Torek) writes:

Chris> Now, using this method, we can prototype function three() without
Chris> having to define `struct foo' in advance:

Chris> 	struct foo;			/* make an incomplete "struct foo" */
Chris> void three(struct foo *);	/* and then refer to it */

Chris> Thus, while C's straightforward scoping rules lead to a rather useless
Chris> effect, the problem is not serious.

I've used this method myself and, of course, it works fine. But I haven't
found a way to forward reference a typedef in the same way.

e.g.

In foo.h I have:

    typedef struct foo
    {
        size_t         len;
        unsigned char *buf;
    } FOO;

In bar.h I want:

    extern void bar (FOO *f);

And in bar.c:

    #include "bar.h"
    #include "foo.h"

    void bar (FOO *f)
    {
       ...
    }

Is there anything I can add to bar.h to ensure that the FOO in the prototype
refers to the typedef defined later, in foo.h ?
--
John M. Farrell                 | Internet: farrell@fjord.reo.dec.com
Digital Equipment Corporation   | 
P.O. Box 121                    | "One foot in the grave, 
Reading, RG1 0TU, UK.           |  and one foot on the pedal", TP
From: hartman@ulogic.UUCP (Richard M. Hartman)
Newsgroups: comp.lang.c
Subject: Re: |const| as an operator
Date: 15 Oct 92 00:00:06 GMT
Organization: negligable

sorry.  this is appropriate to C++ and my newsreader won't
let me cancel (and my previous apology got posted as a
followup to the parent article instead of mine -- I'm
just trying to head off flames about posting in the
wrong group.)

Does anybody know if ANSI C shares the same behavior
as ANSI C++ w/ regard to "const"?  

		-Richard Hartman
		hartman@ulogic.COM

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Fosters!  It's Australian for beer, mate!"

Newsgroups: comp.lang.c,comp.software-eng,comp.sys.mac.programmer
From: d88-jwa@byse.nada.kth.se (Jon Wtte)
Subject: Re: Productivity of a C programmer ?
Originator: d88-jwa@byse.nada.kth.se
Organization: Royal Institute of Technology, Stockholm, Sweden
	<qX3DsB2w165w@comtch.spk.wa.us> <BvvIK4.EuJ@news.cso.uiuc.edu>
Date: Sat, 10 Oct 1992 09:42:36 GMT

> rolf@geoserv (Rolf Wilson) writes:

      I once spent a month improving and rewriting a 6000 line program.
   When I was done it was 4000 lines long. Was my productivity negative?

Actually, a much better productivity (or at least work) measurement
is the size of the deltas produced (you ARE using revision
control, right ?)

     And then double it. Most programmers are pretty good at estimating
   their programming time, but don't seem to realize that they may only
   get half of their day to program in.

Well, then give it to them. Pesky managers should not interfere
with Pure Art in creation :-)

-- 
 -- Jon W{tte, h+@nada.kth.se, Mac Hacker Suedoise (not french speaking) --

   What we need is a good GNU [...] licence manager implementation.
                     -- Raphael Manfredi
Newsgroups: comp.lang.c
From: alpha@waggen.twuug.com (Joe Wright)
Subject: Re: Ok. I'm new and just don't get it.
Organization: ALPHA, Box 68621, Va. Beach, VA 23455
X-Newsreader: TIN [version 1.1 PL6]
Date: Sun, 11 Oct 1992 16:39:13 GMT

Robert Mudry (mushroom@netcom.com) wrote:
: Hello,
: 
: I'm pretty new at C, but I've rapidly grown bored with 'Hello, World' type
: programs and decided to try something a 'bit tougher'.. oh, heck with it,
: let me just ask the dumb question..
: 
: Is there some way I can get a split screen going without it being so darn
: slow (as in curses.. :-) ).. Like how in ircII (ack.. IRC!) the screen seems
: to scroll quick enough even though there is constantly some information on
: the bottom.. This is under UNIX of the flavour SunOS.. and I want to have this
: silly thing output to the top half and bottom half different things, streaming
: in like a mud-client.. and have an 'input line' at the bottom.. but curses is
: miserable for this.. it either (a) redraws the screen after ever line as it
: has to scroll everything upward, or (b) jumps erratically when I set it to
: refresh() after every 5 lines or so.. blanking the screen when it hits the
: bottom is, well, silly... so, any ideas?
: 
: -rjm

Not really a C question..  And you have not picked the easiest of
challenges.  IRC does its split-screen magic assuming an 'ansi'
terminal (vt100) with programmable 'scrolling region'.  You will
need to read up on termcap and the vt100 manual to find out how
this is done.  Curses will probably do it too if you figure out
the 'scrolling region' stuff.
-- 
Joe Wright  alpha@waggen.twuug.com  
Newsgroups: comp.lang.c
From: andy@research.canon.oz.au (Andy Newman)
Subject: Re: Are pointer just addresses???
Organization: Canon Information Systems Research Australia
Date: Thu, 15 Oct 1992 07:41:37 GMT

choi4@gaul.csd.uwo.ca (Wai Kin Choi) writes:
>  "Are pointers just addresses of memory?"
Very often they are.
-- 
Andy Newman (andy@research.canon.oz.au)
"Giving money and power to governments is like giving whiskey and
 car keys to teenage boys" - P.J.O'Rourke
From: martin@mwtech.UUCP (Martin Weitzel)
Newsgroups: comp.lang.c
Subject: Re: Lint Puzzler
Date: 12 Oct 92 13:14:40 GMT
Reply-To: martin@mwtech.UUCP (Martin Weitzel)
Organization: MIKROS Systemware, Darmstadt/W-Germany

In article <1992Sep25.220725.7324@ima.isc.com> karl@ima.isc.com (Karl Heuer) writes:
>In article <1992Sep24.212540.2625@mccc.edu> pjh@mccc.edu (P. J. Holsberg) writes:
>>    fread  llib-lc:stdio.h(177) unsigned int () :: stdio.h(90) int ()
>>    fwrite llib-lc:stdio.h(179) unsigned int () :: stdio.h(90) int ()
>
>Judging from this information, I would say that you have a library that
>attempts to be Standard-conforming and a header that does not.  Check to see
>if there's another version of <stdio.h> somewhere, or perhaps an feature-test
>macro you can use to make this one Standard-conforming.

I know, I'm a bit late, but I think its worth to pick up this thread to
alert the readers to some other pitfall in the "lint libraries vs. header
files story".  Today it's quite common to see sections like

	#ifdef XYZ_COMFORMANCE
		...stuff...
	#else
		...other stuff...
	#endif

in header files which gives you the possibility to decide at compile time
which version you want to use (e.g. cc ... -or- cc -DXYZ_COMFORMANCE ...).
Good for the compiler and also for lint ... unless pre-compiled lint
libraries are used!!! (I only know one implementation which gets this right.)
-- 
Martin Weitzel, email: martin@mwtech.UUCP, voice: 49-(0)6151-6 56 83
Newsgroups: comp.lang.c