HDTenEightyP/NetNews huggingface dataset:
From: dwebster@optima.UUCP (Dave E. Webster Jr.)
Newsgroups: comp.lang.c
Subject: Re: a ? b : c = d; /* legal ? */
Date: 19 Dec 92 00:36:06 GMT

Rich Wells asks:

> Is the statement:
> 
>     a ? b : c = d;
> 
> where a, b, c, and d are all integers, a valid C expression?
  ...
> ***** Microsoft C (7.0 and 5.1): The statement does not compile.
  ...
> ***** Turbo C++ (3.0): The statement is interpreted as:
> 
>     if (a)
>         a = d;
>     else
>         b = d;

Rich,

Assuming that the TC++ implementation should actually read as:

     if (a) b = d; else c = d;
            ^           ^

then both of the above compilers are correct.  The Microsoft compiler
flags an error because the result of the trinary conditional in C is
an rvalue and cannot be the target of an assignment.  C++ changed the
rules by defining the result of a trinary conditional as an lvalue of
type T if (and only if) both the second and third arguments are
themselves lvalues of a common type (cf arm 5.16).

  I have not seen this feature used much in C++ but other languages
with similar semantics make great use of this and similar semantics
(eg: Icon).

Merry XMAS,

Dave
Newsgroups: comp.lang.c
From: tye@spillman.uucp (E. Tye McQueen)
Subject: Re: longjumping out of a signal handler
Date: Mon, 14 Dec 1992 22:34:22 GMT
Organization: Spillman Data Systems

ahoekstr@cs.utwente.nl (Andre D. Hoekstra) writes:
)But if your implementation of signal handlers blocks overrun signals by
)setting a flag on entry in your signal handler, and clearing it on exit,
)you may get stuck with a masked signal, by not exiting from the handler.
)(longjump prevents exit/return obviously). Unless signal clears this
)flag for the signal at hand explicitly you are unsafe.

Well, it is nice to know that some (pre-ANSI?) system have this
problem.  Anyone have a list of *which* systems have this problem?

K&R II doesn't talk about any of this and my copy of the standard
is way outdated, so maybe I'm wrong; but I distinctly recall that
ANSI guarantees only two things that can be done within a signal
handler:  1) Set a variable of type "sig_atomic_t"  and  2) Call
longjump().

If so, how do such systems conform to ANSI C?  Does setjump() save
the signal mask and longjump() restores it?  Is there some require-
ment that I reset the signal myself from within the handler before
calling longjump()?  Or is this just an OS "bug" that newer systems
no longer have?  (I mean, longjump(), if anything, is for exception
handling as are signals so it doesn't make sense to design a system
where they can't be used together.)

I'm not arguing that using longjump() within a signal handler is in
fact safe on all systems.  It clearly is not.  But I don't think
setting a global flag in the signal handler and checking it in a
calling routine will work on all systems either (see below).

Anyone know which systems restart system calls for you in a way that
prevents you from interrupting them with a caught signal so you can
see if your "sig_atomic_t" flag has been set?  Seems like this was a
BSDism.  Is this behavior disallowed by ANSI C, Posix, etc.?

Thanks,
 tye@spillman.com                         Tye McQueen, E.
----------------------------------------------------------
 Nothing is obvious unless you are overlooking something. 
----------------------------------------------------------
From: cthulhu@diku.dk (Stefan Krabbe)
Newsgroups: comp.lang.c
Subject: Re: Question to test general C knowledge
Date: 20 Dec 92 13:45:37 GMT
Organization: Department of Computer Science, U of Copenhagen

rfries@sceng.ub.com (Robert Fries) writes:

> > >  "this is a test"[4]
> > I give up. What is it?
> The value is ' '. 
> An even more bizarre way of writing it is:
>	 4["this is a test"]

>Yes, it works, and yes, this is another example of the useless things
>you can learn by reading news articles.

Hmm. I don't think it's useless. It also follows logically from this:

        ptr[i] == *(ptr + i) == *(i + ptr) == i[ptr]

             Kind Regards
                Stefan
-- 
                                     ___
  Name:  Stefan Krabbe       .......(o o).......
  Email: cthulhu@diku.dk     ---vvv---U---vvv---
  Institute of Computer Science, University of Copenhagen.
Newsgroups: comp.lang.c
From: eric@cadkey.com (Eric Holtman)
Subject: RFD: splitting comp.lang.c
Organization: cadkey
Date: Wed, 16 Dec 1992 15:12:43 GMT


Well, it's getting to the point where kill files just 
aren't working for this group......


Therefore, I propose the following splits for this newsgroup

    comp.lang.c.jeopardy - those wishing to post and answer quaint
	employment quizzes can play Alex Trebek here

    comp.lang.c.homework.server - people too lazy to pass their
	basic Intro to Algorithms can cheat here

    comp.lang.c.user.error.whining - people wishing to discuss
	how to use aq specific library (borland graphics comes to
	mind) can get help here.

    comp.lang.c.side.effects - people who don't understand why
	a[i] = i++ is *UNDEFINED*, and refuse to accept the fact, because
	*their compiler works a certain way*, can display their ignorance here.

    comp.lang.c - questions about the C language, which haven't been
	answered in the past *week* could stay here.


Any thoughts??
-- 
Eric J. Holtman       |
Product Development   | "You fat, bloated, Eeediot!!!"
Cadkey, Inc.          |                      
                      |    - Ren Hoek ("that's Ho-ak, not HOKE!!")
Newsgroups: comp.lang.c
From: kra@cunixa.cc.columbia.edu (Kenneth R Aron)
Subject: FAQ:compiler needed
Organization: Columbia University
Distribution: usa
Date: Sun, 20 Dec 1992 19:47:42 GMT

I realize this is a major-league FAQ, but I searched through
almost 500 articles looking for the FAQ.

I'm trying to teach myself C, and I need a free/shareware C
compiler for DOS.  Could some kind soul e-mail me with the
location of a compiler, or the location of the FAQ.

Thanks,
Ken
Kenneth R. Aron                 NYS EMT-Defibrillation            | |  / /
kra@cunixa.cc.columbia.edu      Columbia Area Volunteer Ambulance | |/ / 
                                Columbia University, NYC          | |\ \
"EMTs do it with patience"                                        | |  \ \
From: pasc1226@altair.selu.edu
Newsgroups: comp.lang.c
Subject: Modem to Modem Linkage Procedures
Date: 16 Dec 92 19:10:22 -0600
Organization: Southeastern Louisiana University

To All C Gurus & Faithful C followers,

	I have a project that requires a communication sequence to share
infromation with another computer.
	I have designed a game in Microsoft C. I now need to let another user
call the (base) computer and share in the playing. 
	You might be familar with some favorite games like "Command HQ" and
"Falcon 3.0". 
	What do I need to do to allow this interaction ?
		Multitasking, or what ?
	Please specify the proper communications sequence.
	The reason why I devolped the game is to do something that I liked
and to show my professors that the developement of a game can be serious busy.
Plus all professors think that if you want to take on a game for a programming
project that it's all B.S. and no actual programming techniques applied.
	My professors could only tell me who to ask (Troy leave a message on the
News System), no one seemed to want to aid in my project design.
	Help me conquer the lack of knowledge that my peers could not fill.

Troy Lee Nall
Hammond, La. USA
TNALL@PASC1226@selu.edu

Q : Do you know what the first thing that go when you get old ?
A : No, but why is it I can only remember the second thing ?  
Newsgroups: comp.lang.c
From: draper@ais.org (Patrick Draper)
Subject: Re: ISAM routines
Organization: UMCC
Date: Fri, 18 Dec 1992 03:41:17 GMT

In article <1992Dec17.001157.7504@osuunx.ucc.okstate.edu> gcouger@olesun.okstate.edu (Gordon Couger) writes:
>Their Address:  MIX Software
>                1132 commerce Dr.
>                Richardson, TX 75081
>                Voice 214/783-6001 fax 214 783-1404
> The phone is answered from 9:00 am to 10:00 or 11:00 pm Central standard time.
>If you have problems with the girl that answeres the phone ask for Dennis or Jimand they can handle the problem they own the company and will be the one that
>answere the pone at night.

You're the first person I've talked to that seems to know some background
stuff on MIX. Who are Dennis and Jim? Did they do anything before MIX that
we all might have heard about?

>
>I have used their stuff for over ten years and I have always been satisified.
>Good luck
>Gordon
>Gordon Couger
>AB5Dg   Agriculture Engineering Oklahoma State University
>gcouger@olesun.agen.okstate.edu 405-744-6514 day 744-2794 evenings   

I also use their stuff and find it very very excellent. Maybe I'm impressed
by the wrong things, but I find their multitasking library much more useful
than their compiler. Could be because I normally use Borland's.

If you don't have the multitasking library, get it soon, you'll like it.

 
------------------////////////////////\\\\\\\\\\\\\\\\\\\\------------------
| Patrick Draper-ZBT       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         |
------------------\\\\\\\\\\\\\\\\\\\\////////////////////------------------
From: bkottmann@falcon.aamrl.wpafb.af.mil (Brett Kottmann)
Newsgroups: comp.lang.c
Subject: Re: No, but strncat() is stupid (was: definition of strncpy stupid?)
Date: 11 Dec 92 09:53:25 EST
Organization: Logicon Technical Services, Inc.

In article <1992Dec10.175103.11502@newshost.lanl.gov>, jlg@cochiti.lanl.gov (J. Giles) writes:
> It's not strncpy() that's poorly designed, but strncat().
> Suppose I have a string for which I've reserved N bytes of
> space.  I want to have string handling functions which 
> provide an easy way to make sure I never run past that
> length when manipulating the string.  The strncpy() function
> does this as well as possible under a function call
> paradigm.  However, consider the strncat() function:
> I can't simply say 
> 
>    strncat(s1,s2,N);
> 
> This would *add* N characters to s1, not limit it's total length
> to N.  In order to do what I want, I have to:
> 
>    strncat(s1, s2, N - strlen(s1));
> 
> Except, I can't do this either.  Previous operations on s1 may 
> have left it without null termination - so strlen() won't work.

	It better have null termination.  strncat uses that to start storing
s2.

Brett
"The opinions and views expressed here are strictly my own and do not 
necessarily reflect the official position of either the U.S. Air Force 
or its contractors."
Newsgroups: comp.lang.c
From: "corey groves" <corey.groves@canrem.com>
Subject: un :purchasing c
Reply-To: "corey groves" <corey.groves@canrem.com>
Organization: Canada Remote Systems
Distribution: comp
Date: 17 Dec 92 14:38:09 EST

RJ>I've been using Microsoft Quick C for about two years now and I
  >really like it - but it may not have everything you're looking
  >for.  It doesn't have Windows support, or mouse support (although
  >I think you can get it for an extra $50).  It's got a very good
  >debugging interface and quite a few compile options.

For a IBM PC platform I would recommend Borland C++ Version 3.1. If you
have enough drive space it is a very comprehensive
compiler/frameworks/debugger package.
Corey
--
Corey J. Groves  | (416) 648-3711          | "Looking down you realize that
Mohawk College   | corey.groves@canrem.com | your never too old to do 
3yr Comp Systems | corey.groves@crs.com    | something really stupid"-W.M.
---
  OLX 3.0 31-1580  ... Error 99: Dead mouse in hard drive
--
Canada Remote Systems  - Toronto, Ontario
World's Largest PCBOARD System - 416-629-7000/629-7044
Newsgroups: comp.lang.c
From: tanner@cdis-1.compu.com (Dr. T. Andrews)
Subject: Re: Questions about token merging and trigraphs
Organization: CompuData, Inc.  (DeLand)
Date: Tue, 15 Dec 92 21:25:45 GMT
X-Phone: +1 904 736 0866
Summary: flame regarding trigraphs & ugliness, please ignore
X-Snail: 1409 E New York Ave; DeLand, FLA   32724.

) What are trigraphs?
Trigraphs are an unpleasant invention from the successor  to  the
horse  committee.   You will recall that the horse committee gave
us the camel.  Well, X3J11 gave us trigraphs.  I believe that the
intention  was to prove that standards groups do better when they
stick with endorsing widely-used practice.

Trigraphs are a nasty way to write certain characters  in  the  C
source  character  set.   These  more  difficult  characters  are
represented  as  three  characters  starting  with   "??".    For
instance, you can represent `#' as "??=".

The change means that certain old programs may have strings, most
likely error messages, compiled into something unexpected.

-- 
uflorida!ki4pv!cdis-1!tanner {uunet dsinc}!cdin-1!cdis-1!tanner
From: csteeves@hpldsla.sid.hp.com (Carl Steeves)
Date: Mon, 14 Dec 1992 18:08:22 GMT
Subject: Re: What is Object Oriented Programming? Is C doomed?
Organization: HP Scientific Instruments Division - Palo Alto, CA
Newsgroups: comp.lang.c

>      I went to a lecture the other day on object oriented 
> programming. The lecture was incomprehensible. The lecturer made 
> it sound like languages like C were no longer capable of handling 
> current programming needs and that a language like C++ would soon 
> be standard. It sounded like an "imminent doom" scenario like 
> those often heard about BASIC and about Usenet itself.
>  

It sounds like the lecturer had "his/her cart before his/her horse."
Object-oriented languages like C++ are not an important thing in and of 
themselves.  Rather, they are important because object-oriented design (OOD) 
is important and you really need an object-oriented language to take
advantage of OOD.  (I have implemented object-oriented designs in C before
but you can only go so far with it; who has the time to try and emulate
OOP features in a C program?)

Object-oriented techniques are fundamentally different from procedural
techniques.  If indeed our current procedural techniques are satisfactory,
then I think it unlikely that things like C++ will ever be very prevalent.
However, I think OOD will become more and more prevalent and therefore 
languages like C will give way to languages like C++.

>      Can anyone explain to me if the catagory of "object 
> oriented" programming (OOP?) is an important one and if there is 
> a difference between "object oriented" programming and "procedure 
> oriented" programming what the significance of this difference 
> is?
>  

I recommend ___Object-Oriented Design With Applications___ by Grady Booch.  
His discussion on this is the best I have seen.
From: mouse@thunder.mcrcim.mcgill.edu (der Mouse)
Newsgroups: comp.lang.c
Subject: Re: travelling salesman
Date: 12 Dec 92 23:18:13 GMT
Organization: McGill Research Centre for Intelligent Machines

In article <FARID.92Dec11140244@gradient.cis.upenn.edu>, farid@gradient.cis.upenn.edu (Hany Farid) writes:

> I am looking for code that enumerates the (N-1)!/2 possible paths of
> the travelling salesman for a map with N cities.

This really isn't a C question; it's a general algorithms question.
However, since the code is trivial and it's likely to be the easiest
and quickest way to get this thread off of comp.lang.c,

	int cities[N]; /* holds city numbers, 0..N-1 */
	int taken[N]; /* holds booleans */

	void enumerate(int depth)
	{
	 if (depth < 0)
	  { /* we have a new path in cities, do something with it */
	  }
	 else
	  { for (cities[depth]=0;cities[depth]<N;cities[depth]++)
	     { if (!taken[cities[depth]])
		{ taken[citites[depth]] = 1;
		  enumerate(depth-1);
		  taken[citites[depth]] = 0;
		}
	     }
	  }
	}
....
	...enumerate(N-1)...

You can of course eliminate the recursion, but there's not much point;
you recurse only N levels, and if N is large enough that this is likely
to cause problems, you aren't going to finish the list before your
computer crumbles into dust from age anyway.

					der Mouse

			    mouse@larry.mcrcim.mcgill.edu
Newsgroups: comp.lang.c
From: jcontro@engws10.ic.sunysb.edu ()
Subject: Help!!!!!!!!!!!!
Originator: jcontro@engws10.ic.sunysb.edu
Organization: State University of New York at Stony Brook
Date: Sat, 12 Dec 1992 18:42:35 GMT

Hello--

I wonder if there is anyone out there who can answer a quick question:

In a function, I declare a pointer to a structure, say:
   SOME_STUCT  *Ptr;

let SOME_STRUCT have a field which contains a Next pointer, etc...

I pass it to a function, like this :

fn( ..., Ptr );

recieve it like :  fn( SOME_STRUCT *Ptr ) { ...

The problem is that inside the funciton I create a linked list,
of which Ptr is the head. I know it does this correctly.
But, when the function returns, the space is lost, I think.  Is it
because I allocated it locally??
And if so, how is it that you return a linked list from a function>?????

Thanx -- I really need it.
Jacqueline.

Newsgroups: comp.lang.c
From: atbowler@thinkage.on.ca (Alan Bowler)
Subject: Re: Is this ANSI?
Organization: /etc/organization
Date: Tue, 15 Dec 1992 20:41:00 GMT

In article <Byr66A.A2A@unx.sas.com> sasghm@theseus.unx.sas.com (Gary Merrill) writes:
>
>In article <1992Dec1.225840.719@thinkage.on.ca>, atbowler@thinkage.on.ca (Alan Bowler) writes:
>|> >
>|> >Nonsense.  See section 3.5.2.1: "Within a structure object, the
>|> >non-bit-field members and the units in which bit-fields reside have
>|> >addresses that increase in the order in which they are declared."
>|> 
>|> True.  The compiler is not free to juggle the order withing a
>|> struct, but as a rule of thumb you you program as if it did have that
>|> freedom.  Similarly, you should treat "union" as if the compiler was
>|> free pretend it read "struct".
>
>Huh?  Why should you do this?  What do you gain by doing so?  Would
>you care to justify these "rules of thumb"?  (There are some pretty
>silly consequences to supposing that a compiler might really *not*
>enforce the standard in this respect.  But right now I leave these
>as an exercise for the reader.  As it is, the suggestion that one
>ought to suppose that the compiler *fails* to implement an explicit
>part of the standard is puzzling enough.)
>
Because at a later time you may want to reorder the structure so that
it gives you better performance on a different machine.  If you have
done things that depend on the order of objects within the struct,
you will find it difficult to locate these dependancies.

>By the way, do you also (as a rule of thumb) program as if the
>compiler might (for example) implement a long as a smaller type
>than a short?
>
>And finally ... If you really *do* treat 'union' as though it might
>mean 'struct' (although I confess I am not at all sure what it *means*
>to treat 'union' in this way), you could be in *real* trouble since
>sequences of operations guaranteed to succeed for structs will fail
>for unions.
What I meant is that except for machine dependant code, the program
should only retrieve a value from a union element, if the last
assignment to that union was to the SAME element name.  I know that
there are things that are guaranteed to work on structs that will fail
for unions.  I am not refering to these cases.  There are also some
things that "work" if you have a union, but would fail if you had 
a struct.  These should be avoided.
     E.g.
        union {
            int i;
            char c;
        } u;

        u.i = 'a';
        printf("%c", u.c);
will "work" on some machines.   This is the sort of thing that should
be avoided.  The last assignment to u was to u.i so only u.i or all
of u should be accessed as a value.
Newsgroups: comp.lang.c
From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
Subject: Re: What do you say.
Organization: Computer Science, University of Melbourne, Australia
Date: Sat, 12 Dec 1992 16:40:41 GMT

droelke@spirit.aud.alcatel.com (Daniel R. Oelke) writes:

>Here's a question for you.  What do you say to a co-worker who
>asks you "What is the difference between equals and equals equals?"
>
>(this guy was recently hired for software developement in C)
>
>  :-(    :-(    :-( 

What *did* you say?

-- 
Fergus Henderson             fjh@munta.cs.mu.OZ.AU      
This .signature virus is a self-referential statement that is true - but 
you will only be able to consistently believe it if you copy it to your own
.signature file!
Xref: sparky comp.lang.c:18275 comp.lang.c++:17877 comp.misc:4570
From: bs@alice.att.com (Bjarne Stroustrup)
Newsgroups: comp.lang.c,comp.lang.c++,comp.misc
Subject: Re: What is Object Oriented Programming? Is C doomed?
Date: 12 Dec 92 23:06:39 GMT
Article-I.D.: alice.24402
Organization: AT&T Bell Laboratories, Murray Hill NJ



 > kdq@quest.UUCP (Kevin D. Quitt ) writes 

 > hartman@ulogic.UUCP (Richard M. Hartman) writes:
 > > 
 > > OOP and C++ is NOT a "silver bullet", any more than "structured programming"
 > > was.  It is a new tool that gives us the potential for things that were
 > > more difficult before, but in and of itself does NOTHING.  That is the
 > > job of the software designer.  If it is done poorly, it is done poorly
 > > no matter what the language or paradigm.
 > 
 >     This is the heart of the matter:  OOP is another device which
 > helps mediocre programmers to produce good code.  Good programmers can
 > also make use of it, but they've *always* produced good code.

Sigh. No that is not the case at all. OO techniques and the tools and
languages that support them help all programmers. The programmers who
have the best grasp of the principles and their practical application
get the most help. In practice, this means that the best programmers
get the most out of OOP (just as they have out of every other effective
technique over the years); they are the ones who have the best understanding
of their applications and of the technique available to build them.
Mediocre and poor programmers also get significant help, but that is
neither the primary aim of OOP nor its main effect. OOP is not a technique
for dumming down programming or deskilling programmers.
 _
Newsgroups: comp.lang.c
From: wong@fraser.sfu.ca (Sam S. Wong)
Subject: Re: Need help: array of pointers to member functions C++.
Organization: Simon Fraser University, Burnaby, B.C., Canada
Date: Wed, 16 Dec 1992 18:47:06 GMT

Never mind.  I figured out the solution.
I have to cast the the address of that member.  Its ugly but it works.

The Solution is:

>-------------------------------------
> 


>class dummy {
> public:
> int hello(void);
>};

>int just_hello (void);

>dummy dumb;              
>int (*fnptr[10])(void);


>main()
>{ 
>  dumb.hello();
>  fnptr[1] = just_hello;
>  (*fnptr[1])();
>  fnptr[1] = (int (*)(void))&dummy::hello;  // cast it this way or
>  fnptr[1] = (int (*)(void))&dumb.hello;    // this way.
>  (*fnptr[1])();
>}


>int dummy::hello (void)
>{
>  printf ("\nhello");
>}


>int just_hello (void)
>{
>  printf ("\njust_hello");
>}


>-----------------------------------------------------