HDTenEightyP/NetNews huggingface dataset:
From: alpha@waggen.twuug.com (Joe Wright)
Subject: Re: can != be used in compound if
Organization: ALPHA, Box 68621, Va. Beach, VA 23455
X-Newsreader: TIN [version 1.1 PL6]
Date: Wed, 30 Sep 1992 02:29:15 GMT

Operator (operator@julian.uwo.ca) wrote:
: 
: can  -- not equal (!=) -- be used in a compound if statement????
: 
: 
: for example:
: 
: 
: rnum is a random number generated by random().
: number_set[] is an array of 6 integers.
: 
: 
: if (rnum != number_set[1] && rnum != number_set[2] && rnum != number_set[3])
: 
: 
: is this if statement correct, if not, what is wrong with it????
: 
If rnum is in fact an int variable, your compound statement is ok.  If
rnum is a float or double, you are in trouble.  Call out the casting crew.

-- 
Joe Wright  alpha@waggen.twuug.com  
Newsgroups: comp.lang.c,comp.lang.pascal,comp.lang.misc
From: karl@ima.isc.com (Karl Heuer)
Subject: Re: SUMMARY: Preferences toward case sensitivity/insensitivity
Organization: Formerly of Interactive Systems, Cambridge, MA
Date: Tue, 29 Sep 1992 16:21:58 GMT

In article <id.IBNT.KP8@ferranti.com> peter@ferranti.com (peter da silva) writes:
>In article <9226902.9004@mulga.cs.mu.OZ.AU> fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) writes:
>>[Using two identifiers in the same scope when they differ only in case
>>should produce a compiler diagnostic.]
>
>[Should be "intersecting scope" rather than "same scope".]  I think this
>would resolve all remaining complaints about BOTH case-sensitive and
>case-insensitive languages, whether you think MAD and mad and Mad are the
>same word, or not.

I agree that it's generally good to write programs in the "case-fascist"
model, which is effectively the intersection of case-sensitive and case-blind.
(I pointed out in email that this option was missing from the original
survey.)

I'm not sure I agree that this would "resolve all remaining complaints".
It's not uncommon for C programmers to use a lowercase name for a variable
whose *type* has the same name capitalized, e.g.  |Thing thing;| (this is
usually either a local variable with short scope, or a global variable
representing the only instance of the type), and I expect some people would
be miffed at getting a warning for this.

Karl W. Z. Heuer (karl@ima.isc.com or uunet!ima!karl), The Walking Lint
From: tim@shovel.Prime.COM (Tim Cantin)
Newsgroups: comp.lang.c
Subject: Re: How can i delete the cursor from my C programs ??
Date: 6 Oct 92 17:36:37 GMT
Article-I.D.: shovel.1992Oct6.133637
Organization: Prime Computer R&D

In article <1992Oct06.163130.19585@dcc.uchile.cl>, lastudil@dcc.uchile.cl (Luis Astudillo Vivar) writes:
> 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.

Some implementations of curses contain the library functions:

	cursoroff();
	cursoron();

which will do the trick. You might not have these on your system.
-T

-- 
#include "stddisclaimer.h"
/* Tim Cantin          {uunet, csnet-relay}!primerd!tim || tim@s35.prime.com
   Prime Computer Inc. 10-21, 500 Old Conn. Path, Framingham, MA 01701 (USA) */
flames > /dev/null 2>&1
From: burgin@currituck.cs.unc.edu (Robert Burgin)
Newsgroups: comp.lang.c
Subject: Fortran to C Translator
Date: 26 Sep 92 20:48:55 GMT

Can anyone point me to an inexpensive program that
translates Fortran code into C?  Thanks.

--rb

Newsgroups: comp.lang.c
From: msb@sq.sq.com (Mark Brader)
Subject: Re: Algorithm for Day-Of-Week NEEDED
Followup-To: poster
Organization: SoftQuad Inc., Toronto, Canada
Date: Sat, 26 Sep 92 05:17:52 GMT

> > leap year if divisible by 4
> >    except if divisible by 100
> >       unless divisible by 400

This is correct.

> The pattern continues indefinitely.
> if 4, but not 10, but if 400, but not 1000, but if 4000...

This is not only wrong, but it isn't even the usual way to go wrong.
Full marks for creativity, but zero for information content.

(The usual way to go wrong is to give the 4-100-400 pattern as in the
correct answer, and then claim that there is a further exception if
divisible by 4000.  Past discussions of this on Usenet have revealed
that [1] some source that you would think would be authoritative makes
this claim -- I think it may have been an edition of the Britannica --
and [2] it is nevertheless wrong.  There are no special rules beyond
the multiples of 400.  In the 16th century the year length probably
wasn't known to enough accuracy to make it sensible to do so, and today
we know that it isn't sufficiently constant on such time scales anyway.)

(In the English-speaking countries, that is.  It has been claimed that
certain other countries have adopted variants of the Gregorian calendar
and will eventually shift away from the rest of the world if someone
doesn't come to ther senses first.)

Followups directed to email.  If you really want to discuss calendars on
the net, sci.astro is probably the best place.
-- 
Mark Brader			"How can we believe that?"
SoftQuad Inc., Toronto		"Because this time it's true!"
utzoo!sq!msb, msb@sq.com		-- Lynn & Jay: YES, PRIME MINISTER

This article is in the public domain.
Newsgroups: comp.lang.c
From: spoulsen@mcs213k.cs.umr.edu (Steven P Poulsen)
Subject: Unix/TC++ compatibility?
Date: Mon, 28 Sep 1992 23:04:28 GMT
Organization: University of Missouri - Rolla

I have Turbo C++ and manuals.  When I write a program using Ansi C standards,
I have problems running on UNIX.  On the UNIX there is no stdlib header and
some of the headers work different.  The name of the compiler is cc but there
are two others that I think cc calls.  I think one is pcc?  Is this supposed 
to be Ansi compatible?  My manuals for TC++ show the ansi compatible headers, 
yet this system lacks a few of them <io.h is another one>.  Please Help.
Steve Poulsen <spoulsen@cs.umr.edu>

-- 
===========================================      ,--,
  Steven P. Poulsen <spoulsen@cs.umr.edu>      ,'  '--,
  Student of Electrical Engineering            ---, ,'
  University of Missouri - Rolla                ,','
From: scjones@thor.sdrc.com (Larry Jones)
Newsgroups: comp.lang.c
Subject: Re: Question about DIR/ALLwriting binary files to mo
Date: 26 Sep 92 19:27:21 GMT

In article <288@ulogic.UUCP>, hartman@ulogic.UUCP (Richard M. Hartman) writes:
> Many fopen()s allow "rw" as the specification for read/write (random)
> access.  Have you tried this?

What implementations have you been using?  I've *never* seen an fopen
that allowed a mode of "rw" and I've used LOTS of different ones.  The
correct mode for read/write access is "r+", "w+", or "a+" depending on
the exact behavior you want.
----
Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH  45150-2789  513-576-2070
Domain: lawrence.jones@sdrc.com               IBMMAIL: USSDR7DR at IBMMAIL
Don't you hate it when your boogers freeze? -- Calvin
Newsgroups: comp.lang.c
From: bjornmu@idt.unit.no (Bj|rn P. Munch)
Subject: Re: C-formattors (problems with very long lines)
Organization: Div. of CS & Telematics, Norwegian Institute of Technology
Date: Wed, 30 Sep 92 17:16:26 GMT

In article <1992Sep29.073835.29459@olymp.informatik.uni-bonn.de>, hermann@uran.informatik.uni-bonn.de (Hermann Stamm) writes:
|> 
|> The problem now is, that this macro expands to roughly 80.000
|> bytes of ASCII-Text, and by the nature of macro-replacement,
|> this is a single logical line. It works fine, but when debugging
|> I need to work on the preprocessed text, and this is not very 
|> easy to read because of such long lines.
|> 
|> I tried to use "indent" and "cb" on the preprocessed text,
|> but got errors, because both programs produced the following
|> ugly result:
|> 
|>   .....   XYZ->ABC ......
|> 
|> was transformed to
|> 
|>  .... XYZ-
|> >ABC ....
|> 
|> This results in a compiler-error.
|> I wrote my own simple "C-beautifier", which simply does the
|> following:
|> 
|>    - discard empty lines
|>    - insert a '\n' after each ';' found
|> 
|> This works fine, but now I have 2 questions:
|> 
|>   1. Is this a correct transformation of any C-Source ?
|> 
|>   2. Is there a beautifier available working correct even
|>      on very long Source-lines ?

I had a similar problem once, where I had to break down results of
some huge macros into lines.

The trick I used was to write the macro defs like this:

---
#define MACRO(x)  if (x)  {@\
    frob ((x) + 1);@\
    for (i = 0;  i < (x);  i++)@\
      grok (i, "long macro\n");@\
    printf ("which expands to many lines\n");@\
  }@
---

Then after preprosessing, filtered it through

  tr @ '\012'

, which replaced all those silly @'s with newlines.

The advantage of this method is that you can format the text exactly
as you want it.

Warning: if your cpp barfs on the @ signs, you may be out of luck.
Also watch out for @ in strings.

 - BugWriter

PS.  Actually, my filtering was more complex, as I also wanted to call
my macros with arguments *containing* commas.  But that's another story...

---
Bj|rn P. Munch               | Dept. of Comp. Science & Telematics,
Bjoern.P.Munch@idt.unit.no   | Norwegian Institute of Technology (NTH),
PhD Student                  | N-7034 Trondheim, Norway
Univeristy of Trondheim      | Fingerable addr:  bjornmu@multe.idt.unit.no
From: dmills@accvio.intel.com (Dave Mills)
Newsgroups: comp.lang.c
Subject: Re: can != be used in compound if
Date: 30 Sep 92 16:11:00 GMT
Organization: Intel Corporation
News-Software: VAX/VMS VNEWS 1.41

In article <30SEP199207384410@accvio.intel.com>, dmills@accvio.intel.com (Dave Mills) writes...
>In article <1992Sep28.194631.25334@julian.uwo.ca> operator@julian.uwo.ca (Operator) writes:
>>rnum is a random number generated by random().
>>number_set[] is an array of 6 integers.
>>
>>if (rnum != number_set[1] && rnum != number_set[2] && rnum != number_set[3])
>>
>>is this if statement correct, if not, what is wrong with it????
>> 

I said the following bogus stuff...

>I think the problem here is operator precendence.  If my memory serves me,
>without K&R in hand, && has higher precendence than !=.  This generates a
>perfectly legal C statement, but doesn't do anything like what you expected.
>Add a few parens, like this:
>	if ((rnum != number_set[1]) && (rnum != number_set[2]) &&
>		(rnum != number_set[3]))
>and it should work okay.
> 
>Dave

.and, I've been informed that I was not quite accurate.  Well, actually,
I was completely wrong.

Sorry for the bad lead...

Dave
---------
David Mills
Intel Corporation
dmills@intel.com
Newsgroups: comp.lang.c
From: pjh@mccc.edu (P. J. Holsberg)
Subject: Strings and integer sizes
Organization: The College on the Other Side of U. S. 1
Date: Fri, 2 Oct 1992 02:06:32 GMT

Multiple choice question:

A string is stored
	a. in an array of characters
	b. in an array of characters terminated with 0
	c. in an array of characters terminated with '\0'

(T or F) The ANSI Standard for C guarantees that
	sizeof(short) <= sizeof(int) <= sizeof(long)

I'm interested in your answers and your comments about the questions.

Thanks,
Pete
Newsgroups: comp.lang.c
From: gsen@twins.goldstar.co.kr
Subject: Getting file attribute from SunOS
Organization: GoldStar Co.,LTD. Consumer Electronic Research LAB. Seoul, Korea.
Date: Fri, 2 Oct 92 08:42:10 GMT

Does anybody know how to get file attributes from existing files in 
SUNOS ?  It seems to me 'dir.h' can give only file names and number
of files in a specified directory.  The attribute info I'd like to 
get is "date and time".  Any help will be appreciated.
--Hee-won Seo
Xref: sparky comp.lang.c:14315 sci.space:13777
From: wingo%cspara.decnet@Fedex.Msfc.Nasa.Gov
Newsgroups: comp.lang.c,comp.unix.progammer,sci.space
Subject: Re: Easter
Date: 30 Sep 92 16:22:00 GMT
Article-I.D.: judy.30SEP199211225318
Organization: University of Houston
News-Software: VAX/VMS VNEWS 1.41

In article <1992Sep30.124004.17688@bnr.uk>, agc@bmdhh298.bnr.ca (Alan Carter) writes...
>In article <8f4.ANN@saxon.UUCP>, fletcher@saxon.UUCP (Edward F Eaglehouse) writes:
>|> I don't have any actual code to calculate Easter, but if I remember
>|> correctly Easter falls on the first Sunday following the first full moon
>|> after the Vernal Equinox.
>|> 
>|> An astronomical programmer should be able to provide this one.  Somebody in
>|> sci.space probably can give us a formula.
> 
>It's in Knuth Vol. 1 (what isn't?). Algorithm E, Exercise 14, Section 1.3.2.
>He comments "Easter is supposedly the 'first Sunday following the first full 
>moon which occurs on or after March 21st.' Actually perturbations in the
>moon's orbit do not make this strictly true, but we are concerned here 
>with the 'calendar moon' rather than the actual moon. The Nth of March is
>a calendar full moon."
> 
>Odd that Easter Sunday is what it is based on. I thought Christians put
>more emphasis on the Crucifiction and Resurrection than on Easter
>Sunday, which was a day that not much happened on. 
> 
>   Alan
> 
This is totally tangental to sci.space but the reason for the date corresponding
to a lunar system is to stay in sync with Passover. There is a complex 
relationship between the the day of Christ's death and resurrection so that
it was guaranteed to to happen on a certain date tied to the feast days of
the Jewish people. 

For those who believe none of this ignore it.  The history is facinating in
and of itself.  The Jews had a lunar calender and a year of 360 days. Also
the time of day that the day started was at sunset and not at midnight as is
the modern norm.

The only reason that I post this response back to sci.space is to point out
that astronomy even professional astronomy is an ancient science with 
Chinese records of sunspots dating back three thousand years and supernova
records in the near east going back four thousand years.  An interesting
study for those interested in long term trends.  The sunspot records have
been an especially fruitful field in the last few years for solar
researchers.

Dennis, University of Alabama in Huntsville
From: alfaroja@vtcc1.cc.vt.edu (L. D. ROPER)
Newsgroups: comp.lang.c
Subject: Pascal 2 C
Date: 28 Sep 92 04:16:00 GMT
Organization: Virginia Tech, Blacksburg, Virginia
News-Software: VAX/VMS VNEWS 1.41

I am looking for a Pascal to C converter.  Thanx in advance...

Alfaroja@vtcc1.cc.vt.edu
From: GM08@DKAUNI2.BITNET (hans friedrich steffani)
Newsgroups: comp.lang.c
Subject: Re: NULLing a pointer and INT 0x1c
Date: 6 Oct 92 14:42:26 GMT
Organization: University of Karlsruhe, Germany



> 1- how do you change the value of a pointer passed to a subroutine? It seems
> to me like you can do almost anything with it except changing the value
> to NULL. This is what I mean:
>
> pass(struct something *p){
>          p=NULL;
> }
ALL arguments (in C) a passed by value not by reference|
so also the pointer p is passed by value. you can change
the memory p points to (that ist *p) but not p itsself.
perhaps you ll understand if you read
> pass(struct something*   p){
>          p=NULL;
> }
>
>

hans friedrich steffani
Newsgroups: comp.lang.c,comp.windows.x,comp.sys.unix
From: msmcknig@unccsun.uncc.edu (Michael S McKnight)
Subject: Opening an output window from within an application in Xwindows
Organization: University of NC at Charlotte
Date: Thu, 1 Oct 1992 00:30:30 GMT

I have am writing an application under xwindows in C.  I need to open an
output shell-type window from within my application and redirect any text
output to it... Something like:

MakeTextWindow(windowname,xwidth,yheight);

PrintTextWindow(windowname,"...",vars...);

Is there anyway to do this?  XDrawString is way to cumbersom and inflexible.
I mentioned this before and got several mentions of an XTerm... what is this
and how would I open one from within my application and redirect text to it?

Please, any help will be greatly appreciated.  Code, books and/or ideas!!!

Please Email me directly:  
Michael McKnight -- msmcknig@unccsun.uncc.edu

-- 
_________________________________________________________________________
| Michael McKnight -- msmcknig@unccsun.uncc.edu |    Amiga 3000-25/100  |
|                     msmcknig@mosaic.uncc.edu  |  Insight 386DX-25/105 |
-------------------------------------------------------------------------
Newsgroups: comp.lang.c,comp.lang.c++,comp.unix.admin,comp.unix.sysv386,comp.unix.programmer,comp.unix.shell,bsu.unix,comp.unix.wizards
From: zdxh0a@trc.amoco.com (Douglas Horn)
Subject: Re: Need a formatter for C programs
Originator: zdxh0a@gpss53
Organization: Amoco Production Company, Tulsa Research
Date: Mon, 28 Sep 1992 21:17:47 GMT


In article <2746@bsu-cs.bsu.edu>, pickens@bsu-cs.bsu.edu (David B. Pickens) writes:
> I have inherited a project written in C and it is in dire need of
> being formatted in K&R or some other easy to read style.  I tried
> to use cb - c beautifier on my unix machines, but it only does
> indentation.
> 
> I am looking for either a program written in ANSI C or a shell
> script for UNIX V.  Any other ideas welcomed.
> 
> Please e-mail me so bandwidth is not wasted.  I'll post a follow-up
> as to what worked.
> 
> David
> 
> 
> Newsgroups: comp.lang.c,comp.lang.c++,comp.unix.admin,comp.unix.sysv386,comp.unix.programmer,comp.unix.shell,bsu.unix,comp.unix.wizards,comp.unix.misc
> Subject: Need a formatter for C programs
> Summary: 
> Expires: 
> Sender: 
> Followup-To: 
> Distribution: 
> Organization: Dept. of CS Ball State University Muncie IN
> Keywords: 
> 
> I have inherited a project written in C and it is in dire need of
> being formatted in K&R or some other easy to read style.  I tried
> to use cb - c beautifier on my unix machines, but it only does
> indentation.
> 
> I am looking for either a program written in ANSI C or a shell
> script for UNIX V.  Any other ideas welcomed.
> 
> Please e-mail me so bandwidth is not wasted.  I'll post a follow-up
> as to what worked.
> 
> David
> 
> 
> -- 
> David B. Pickens | pickens@bsu-cs.bsu.edu 
> Grad. Student & Grad. Assistant | Center for Information and
>                                   Communication Sciences
> "Ouch!" - Newton's first words after discovering gravity


Try GNU indent program. It should be on most of the anonymous ftp
sites.

-- 
/*  Douglas Horn (zdxh0a@trc.amoco.com)     (918)660-3247             

    Helpful hints:   Stop programming before it is too late.  */
From: 6500mack@ucsbuxa.ucsb.edu (Michael P. Mack)
Newsgroups: comp.lang.c
Subject: Re: C macro question
Date: 26 Sep 92 19:28:26 GMT

In article <1992Sep20.222308.12290@mnemosyne.cs.du.edu>
jepler@nyx.cs.du.edu (Jeff) writes:
>I could write something like this:

>int BIGGEST_a, BIGGEST_b;
>#define BIGGEST=((BIGGEST_a=(a)>BIGGEST_B=(b))?BIGGEST_a:BIGGEST_b)

>But this would limit me to a single type.

Something you may try (I'm sure it will be criticized) is

  #define BIGGEST(a,b) ((BIG_A=(double)(a))>(BIG_B=(double)(b)) ? BIG_A:BIG_B)
  double BIG_A, BIG_B;

  int x,y;

  printf("biggest(%d,%d) = %d\n",x,y,(int)BIGGEST(x,y));
                                     ^^^^^
  printf("biggest(sin 3.2, cos 2.1) = %f\n",(float)BIGGEST(sin(3.2),cos(2.1)));
                                            ^^^^^^^
                                            must cast to desired type

Mike Mack
6500mack@ucsbuxa.ucsb.edu

Newsgroups: comp.lang.c
From: vasco@jessica.bvl.pt (Antonio Vasconcelos)
Subject: Re: What is Curses?
Reply-To: vasco@jessica.bvl.pt (Antonio Vasconcelos)
Organization: Bolsa de Valores de Lisboa 
Date: Tue, 6 Oct 1992 13:18:48 GMT


>Just what in the heck is curses?  I come from the dos world, and I have little 
>experience with unix environments.  I've gathered it's some sort of C gui 
>library, and I've noticed some mention of it in DJGPP's doc's.  Is it available 
>for dos?  Should I care if it is?

Not really a GUI, it's a terminal (text only) control library.
Curses have funtions to move the cursor, define and scroll text windows, you 
even get funtions that let you scan the keyborad (sort of speaking) for an 
incoming char without blocking until one is available.

The curses library is more or less the standard in Unix World, there are a few 
curses implementations for MS-DOS, public domain, I think.

The only reason I can think for using curses under ms-dos is portability for unix 
machines.

regards,

    ///////////////////////
  /// vasco@jessica.bvl.pt ///
///////////////////////
Newsgroups: comp.lang.c
From: kauffman@slab.unt.edu (DON KAUFFMAN)
Subject: comp.lang.c FAQ list
Organization: School of Library & Info Sci, UNT
Date: Sat, 3 Oct 1992 18:37:11 GMT


	First of all, I would like to thank the many people who
	responded to my question regarding the FAQ list.

	I now have the latest posting, but I never saw it posted
	locally in the comp.lang.c group.  This tells me either
	that it is posted here with a VERY early expiration time,
	or that it is filtered out either at this site or on its
	way here. I will be talking with the local system
	administrator very soon.

	Once again, thanks.
Newsgroups: comp.lang.c
From: wade@nb.rockwell.com (Wade Guthrie)
Subject: Re: Curses to write to stderr, possible?
Organization: Rockwell International
Date: Tue, 6 Oct 1992 03:31:25 GMT


In article <1992Sep30.224314.17911@athena.mit.edu>, alsaggaf@athena.mit.edu (M. Saggaf) writes:
> I have a need to write a program that uses curses to write to stderr
> (since stdout is redirected to a device). Is that possible? if so, how
> is that done? Please help. I'll later summarize.

I think that you are asking the wrong question.  Your whole approach should
be different in curses; your errors don't go to stderr, they should go to
an error window.  What I've done in my code is to declare a global called
'DebugWin'.  All my error output is done through either a 'wprintf' to
DebugWin (and yes, I make sure DebugWin is defined before I print), or through
a pop-up window (this is another approach).

Wade
wade@nb.rockwell.com
From: karl@ima.isc.com (Karl Heuer)
Newsgroups: comp.lang.c
Subject: Re: ++i = i++ ?
Date: 28 Sep 92 18:23:28 GMT
Article-I.D.: ima.1992Sep28.182328.26069
Organization: Formerly of Interactive Systems, Cambridge, MA

In article <1992Sep28.162405.29567@fzi.de> xiong@fzi.de writes:
>       for (i = 0; i < Count, ++i)
>Then I made a typo by writting down "i++" instead of "++i" ...
>The result: both of them are functioning (offer the same result)!

The FAQ is on its way.  (This is mentioned in 3.3.)

>Reply-To: fzi.de

Please ask your news administrator to fix that.

Karl W. Z. Heuer (karl@ima.isc.com or uunet!ima!karl), The Walking Lint
Newsgroups: comp.lang.c
From: hpv@kelvin.uio.no (Hans Peter Verne)
Subject: Re: Problem using fseek
Organization: University of Oslo, Norway
Date: Fri, 2 Oct 1992 10:37:05 GMT


In article <1992Oct2.030809.26674@mnemosyne.cs.du.edu>  ghuntres@nyx.cs.du.edu (Gary  huntress) writes:

>Is there any reason why the following wont work (IBM PC w/ msc 6.0)
>fh=fopen("foo.dat","a");
>if(fh==NULL) exit(-1);
>fseek(fh,-5L, SEEK_CUR);
>It just sits at EOF!  It does not rewind.

Hm ! A pc is a pain in the back on textfiles (imho). 
According to the description of fseek in K&R 2 (apx. B 1.6),
SEEK_CUR (the second arg) should be zero on text-streams. 
So logically: Try to open your file in binary !

The Brute Force way: 
Unless the file is to big, you can just read it all in to a buffer
and manipulate it as one large string, with strrchr to look for the 
last newline, etc.

Hans Peter.
            - "What good is magic if it can't save a unicorn ?" -