HDTenEightyP/NetNews huggingface dataset:
From: mcdonald@aries.scs.uiuc.edu (J. D. McDonald)
Subject: Re: Questions about token merging and trigraphs
Organization: UIUC SCS
Date: Thu, 17 Dec 1992 14:23:53 GMT

In article <2404@sdrc.COM> scjones@thor.sdrc.com (Larry Jones) writes:

>In article <1TA04E3@cdis-1.compu.com>, tanner@cdis-1.compu.com (Dr. T. Andrews) writes:
>> 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.

>If you have a better solution to not having some of the C source
>characters available in your local character set, I'd like to hear it. 
>Remember that it must work for preprocessor commands (since '#' is one
>of the questionable characters) and in character and string literals as
>well as in more ordinary contexts.  X3J11 recognizes that trigraphs are
>a terrible solution to the problem, but they're better than any other
>solution we could find.

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

>The specification for trigraphs was carefully crafted to avoid as much
>breakage as possible.  The most likely problem is a string containing
>the punctuation "??!" which will be interpreted as "|", but this is a
>non-standard punctuation ("?!?" and "!?!" are much more common) -- lots
>of people grep'ed lots of code and I think found exactly one occurrance.
>----

That last it **UTTERLY WRONG**. I found that **many** of my programs
broke!! **MANY** .. and they had lots of occurences of ??!, 
??) ??(, ??[. and ??] in them, in **critical** places!!!

I chose them as delimiters in a special ASCII file format for data,
and chose them as no one would be likely to try to use them as
actual strings in the text-comment portion of the file!! They are coded
into the program in strings .. and it would not have been so bad had
not the idiotic ANSI committee decided that they would be replaced in
strings as well as code!!

Trigraphs were by far the most serious mistake made by the ANSI C
committee, as serious, in fact, as the myriads of stupid things done by the
Fortran committee.

\LARGE

THEY BREAK EXISTING CODE!!!

\normal

and that alone shoudl have said that they **SHOULD NOT HAVE BEEN INCLUDED**.

BECAUSE OF THEM, it is **IMPOSSIBLE** to write code that is both
K&R I and ANSI!!!

If all those caps make it looks like I am shouting because I am 
annoyed, you get the point!

Ordinary C was never broken in this regard, so no fix was necessary.
Trigraphs should be removed from the standard, TODAY.

Doug MCDonald
From: david.brooks@cutting.hou.tx.us (David Brooks) 
Newsgroups: comp.lang.c
Subject: Re: Purchasing C
Date: 15 Dec 92 15:36:00 GMT
Distribution: world
Organization: The Cutting Edge - Houston, TX - 713-466-1525
Reply-To: david.brooks@cutting.hou.tx.us (David Brooks) 


GK> I am looking at possibly purchasing a C compiler.
GK> I would like something that has a debugger and a
GK> decent library, but that does not cost hundreds
GK> of dollars.

GK> Does anyone have any suggestions?


   Sure, use SAS/C v6.0 for Amiga. Of course you'll need an Amiga to use
it... but then you never did say what kind of a system you were running
did you?

   David

 * Q-Blue v0.7 [NR] *                                                                                                             
----
+---------------------------------------------------------------------+
| The Cutting Edge BBS (cutting.hou.tx.us)    A PCBoard 14.5a system  |
| Houston, Texas, USA    +1 713 466 1525          running uuPCB       |
+---------------------------------------------------------------------+
Newsgroups: comp.lang.c
From: pal@regent.e-technik.tu-muenchen.dbp.de (Peter Loibl)
Subject: Re: Peek/Poke in C
Organization: Technical University of Munich, Germany
Date: Fri, 18 Dec 1992 10:15:47 GMT

ericwebb@blackwlf.gwinnett.com (eric webb) writes:

>Hi again.. does anyone know how to do equivalent of BASIC's PEEK & POKE
>statements in C?

I am sorry for my ignorance, but what are PEEK and POKE doing? If you
describe their task, then this would be lots of help for all the
"C-Gurus" here.

Peter Loibl
pal@regent.e-technik.tu-muenchen.de
Newsgroups: comp.lang.c
From: mlandaue@ux4.cso.uiuc.edu (Michael C Landauer)
Subject: Re: Gif file format
Organization: University of Illinois at Urbana
Date: Tue, 15 Dec 1992 18:05:33 GMT

John.Gibney@f386.n632.z3.fidonet.org (John Gibney) writes:

> -=> Quoting Tim@rcsl.demon.co.uk to All <=-

> Ti> From: tim@rcsl.demon.co.uk (Tim Frost)
> Ti> Organization: Roundhill Computer Systems Limited

> >Can anyone provide details of the GIF89A data file format
> >for me please?  

> Ti> If you get hold of the source for FRACTINT this has code in C to
> Ti> read and write GIF files.

>FANX! for your suggestion...  However, I already have a copy
>of the source to FRACTINT V15.1... and I'm finding the code
>rather *difficult* to follow -- I'm trying to find a GIF file
>definition something like:-

>        Bytes Name     Description
>        ----- -------- ---------------------------
>        0-5   Version  Version of GIF, e.g. GIF89a
>        6-7   Encode   Encoding scheme
>                       1=run length encoding
>                       2=Huffman...

>              Etc...

>so that I can "start from scratch".  I've written my
>programs in C, with various "controls" so I can build image
>files on VAX/VMS and MS-DOS but I'd ultimately like to use
>GIF for the data files so I can use FRACTINT to display the
>finished images.


>John  :-)

>... %SYSTEM-W-TMNYFNGRS, too many fingers on keyboard
>___ Blue Wave/QWK v2.10

> * Origin: Eastern Mail Centre [PEP] OZ. +61-3-725-1621 (3:632/386)

There are documents explaining the gif87a and gif89a formats avaible
by anonymous FTP on ftp.ncsa.uiuc.edu.


Mike Landauer
mlandaue@ux4.cso.uiuc.edu

------------------------------------------------------------
|                                                          |
|           "Oh, hell, I dunno." - Bono (U2)               |
|                                                          |
------------------------------------------------------------
From: pat@rwing.UUCP (Pat Myrto)
Newsgroups: comp.lang.c
Subject: Re: ...so I typed this in straight from the book...
Date: 12 Dec 92 05:57:59 GMT
Organization: Totally Unorganized

In article <1992Dec8.153936.15082@prl.philips.nl> ribeiro@prl.philips.nl (ribeiro ma) writes:
:In article <1g108jINNdg8@terminator.rs.itd.umich.edu> colinj@monet.ccs.itd.umich.edu (Colin Eric Johnson) writes:
:>I typed this in straight in from the Kelly & Pohl book and it
:>dumps core every time I try to run it. Lint Hates it (says
:>main returns a random value).
:>
:>What's up with that?
:>---------------------
:>
:>#include   <stdio.h>
:>#include   <string.h>
:>
:>#define    MAXSTRING   100
:>
:>main()
:>{
:>     char  c = 'a', *p, s[MAXSTRING];
:>
:>     p = &c;
:>     printf("%c%c%c ", *p, *p + 1, *p + 2);
:>     strcpy(s, "ABC");
:>     printf("%s %c%c%s\n", s, *s + 6, *s + 7, *s + 1);
:>     strcpy(s, "she sells sea shell by the seashore");
:>     p = s + 14;
:>     for ( ; *p != '\0'; ++p) {
:>	  if (*p == 'e')
:>	       *p = 'E';
:>	  if (*p == ' ')
:>	       *p = '\n';
:>     }
:>     printf("%s\n", s);
:>}
:	This piece of code compiles and runs fine with the standard cc equaliser
:available with version 8.05 of HPUX. The output it gives is:

I tried it and it ran for me, too, but that doesn't mean the code is right.

I think that is just luck of how memory is laid out that it ran at all.
The last expression in the printf() stmt under question (that is, 
'*s + 1') evaluates to a CHARACTER.  The format specifier is for a STRING,
however.   The character in this case is 'B' which is being treated as
a memory location for a string.  What is there at virtual address
0x00000000b is anybodys guess, but if its unused .bss or .data space
somewhere it would be zeroed on a UNIX system.

My guess is that %s in the format specifier is a typo, (which should
have been a %c) either in the original or it got changed in typsetting.

:abc ABC GH <-----  

[...] 

This aint right, I think.  It should be GHB, (or if both the format string
and the expression are screwed up in typesetting, the expression should
be *s + 8 to give GHI).  All this is guessing, since I don't have the
book, to get any idea of the context.  For all I know, the example is
SUPPOSED to fail...  I did try the code example several ways and I
really think that last %s should be a %c.

[...]

:	Which compiler are you using?

Plain ol' vanilla real (AT&T's K&R) compiler.  :-)

:	Milton Ribeiro (ribeiro@prl.philips.nl)


-- 
pat@rwing.uucp                                  (Pat Myrto),  Seattle, WA
                      If all else fails, try:
         ...!uunet!{pilchuck, polari}!rwing!pat
WISDOM:    "Travelling unarmed is like boating without a life jacket"
From: scjones@thor.sdrc.com (Larry Jones)
Newsgroups: comp.lang.c
Subject: Re: Calling convention: C vs PASCAL
Date: 13 Dec 92 18:54:36 GMT

In article <7NJoVB1w165w@quest.UUCP>, kdq@quest.UUCP (Kevin D. Quitt) writes:
>     A quick question to others:  It has always been "common knowledge"
> that these two things are at the heart of C (right-to-left pushing and
> the caller clearing the stack).  I've read the ANSI standard, but I
> couldn't find a mention of these things.  I assume it's got to be
> there, but where?

Those things are at the heart of most common implementations of C, but
they certainly aren't fundamental to the language.  For example, the
official Vax calling conventions place the size of the stack frame at
the very beginning of the frame so the callee CAN pop the stack frame
rather than the caller.  Similarly, there's no reason an implementation
couldn't push the arguments left-to-right as long as the callee has a
way to find the first argument (if the callee doesn't have a variable
argument list, this is quite simple).  The C Standard only specifies
how an implementation must behave, not the details of how to produce
that behavior.  As long an implementation can produce code that works
correctly, what difference does it make?
----
Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH  45150-2789  513-576-2070
larry.jones@sdrc.com  or  ...uunet!sdrc!larry.jones
It's SUSIE!  It's a GIRL!  Santa would understand! -- Calvin
Newsgroups: comp.lang.c
From: mccall@mksol.dseg.ti.com (fred j mccall 575-3539)
Subject: Re: Question to test general C knowledge
Organization: Texas Instruments Inc
Date: Fri, 18 Dec 1992 18:22:06 GMT

In <1992Dec18.162732.15771@leland.Stanford.EDU> dkeisen@leland.Stanford.EDU (Dave Eisen) writes:

>In article <1992Dec18.135841.14009@crd.ge.com> volpe@ausable.crd.ge.com writes:
>>
>>Actually, I prefer the more obfuscated form:
>>  4["this is a test"]
>>
>>And ask them what the type and value is, and WHY this expression is legal.

>We all know what the type and value is (well it's if type char and
>has value ' ' for those who don't know), but why it is legal is
>a philosphical question more than anything else. The best answer
>I can think of is "because dmr fucked up." Yes, x[y] is always
>*(x + y) so it can make sense if x is a pointer an y is integral *or*
>vice versa, but why do this? 

>I can't think of a legitimate reason why you'd want to use x[y] where 
>x is an integer and y a pointer. And a compiler is certainly capable
>of checking types before it replaces x[y] with *(x + y). Or is there
>a reason, other than the obvious need for fodder for Obfuscated C
>contests, why this construct should be in the language?

I've always considered this to be a lovely orthogonality in the
language, on a par with declarations and usage of variables looking
the same (which, in my opinion, ANSI screwed up with the new-style
function declarations -- now in order to get the type checking I have
to use a 'special' way of declaring things up in the actual function
declaration; I understand why they did things the way they did, but I
don't have to LIKE it.  ;-)).

It's one of those things I'd never use, but it's pleasant to know that
the language rules are nice and orthogonal about this.  Aesthetically
pleasing. 

-- 
"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.
From: rumisk@garfield.cs.mun.ca (Jonathan Fernandes)
Newsgroups: comp.lang.c
Subject: -=* source code for pi please *=-
Date: 14 Dec 92 02:10:34 GMT
Organization: CS Dept., Memorial University of Newfoundland

Would someone be so kind as to post or mail me the source code for a programm
that would calculate and print pi to an infinite decimal until signaled by me to stop?

This request is solely for the purpose of interest.

Thanx.


 _____________________________________ _______________________________________
|`Tis strange but true,               |       ________                        |
|  for truth is often strange-        |___       /   rumisk@odie.cs.mun.ca    |
|    stranger than fiction'   --Lord Byron|     /---                          |
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\~~/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                             \/
From: volpe@bart.NoSubdomain.NoDomain (Christopher R Volpe)
Newsgroups: comp.lang.c
Subject: Re: Question to test general C knowledge
Date: 18 Dec 92 13:58:41 GMT
Reply-To: volpe@ausable.crd.ge.com
Organization: GE Corporate Research & Development

In article <1992Dec16.231449.22903@cs.uow.edu.au>, davidr@cs.uow.edu.au (David Ian Raymond) writes:
|> d_north@ondec.lonestar.org (David G. North, CCP) writes:

|> >Or better yet, what is the type and value of the following expression:
|> >  "this is a test"[4]
|> 

Actually, I prefer the more obfuscated form:
  4["this is a test"]

And ask them what the type and value is, and WHY this expression is legal.

|> 
|> 
|> I give up. What is it?
|> 

Its type is char and its value is the numeric value of the space character.

|> 
|> 
|> >-- 
|> >David G. North, CCP
|> >d_north@ondec.lonestar.org {...!texsun!montagar!ondec!d_north}
|> >onDEC systems                                 "Everyone's crazy but you & me...
|> >P.O.Box 795848, Dallas TX  75379-5848          and come to think about it, I'm
|> >(214)985-1316 ... (214)902-3957                not so sure about you either!"

-- 
==================
Chris Volpe
G.E. Corporate R&D
volpecr@crd.ge.com
Newsgroups: comp.lang.c
From: scs@adam.mit.edu (Steve Summit)
Subject: Re: Question to test general C knowledge
Organization: none, at the moment
Date: Thu, 17 Dec 1992 19:00:25 GMT

In article <1992Dec14.222413.28898@newshost.lanl.gov>, jlg@cochiti.lanl.gov (J. Giles) writes:
>    varname%4
> [vs.]
>    varname&03
> These two do the same thing if `varname' is a positive (or unsigned)
> integer variable.  They may behave differently if `varname' is negative
> or if it's not an integer.  The AND is still faster.

Whether or not the AND is faster is immaterial, as any C compiler
worthy of the name can and will replace a modulus operation by a
mask if it is in fact correct and better to do so.  (As I am fond
of pointing out, Ritchie's original PDP-11 compiler performs
this optimization, even without the -O switch in effect.)  There
are a few "source code" optimizations which it may still be worth
making, but replacing % by & (or / by >>) isn't one of them.

					Steve Summit
					scs@adam.mit.edu
Newsgroups: comp.lang.c
From: thayne@unislc.uucp (Thayne Forbes)
Subject: Re: TSR sources : request .
X-Newsreader: TIN [version 1.1 PL6]
Organization: HomeVax
Date: Wed, 16 Dec 1992 03:10:08 GMT

Jan Wieck (wieck@jwminhh.hanse.de) wrote:
: rodnay@chen.bgu.ac.il (guy rodnay) writes:
: : 
: : I would very much apreciate any help on TSR's and any memory
: : resident information (sources , if possible ) .
: 
: Any Program can be made stay resident.
: 
: - Under MVS write some JCL and do SUBMIT.
: - Under BS2000 try SUBMIT (not sure, long time ago).
: - Under VMS use SUBMIT with a DCL-procedure.
: - Under UNIX use & as the last part of the commandline.
:   In some cases you need nohup(1).

This is not what he asked, and it is not even correct if it was.  
ANY program _cannot_ be made stay resident [sic].  Nearly any program
that does not require interactive input, whose output is not needed on
a tty, and does not need to be brought to the foreground on command can
be run in the background.

: So, where is the Problem? And if there is anyone, it isn't a C-problem!!!

Of course any smart-ass who recognizes the acronym TSR knows that Guy
was refering to DOS.  TSR programs are not at all trivial in DOS.
I got a lot of good info from "Undocumented DOS" by Schulman et. al.
published by Addison Wesly  The copy I got had a source disk in the 
back.  I also got a lot of suggestions and samples from a file that I 
got on the local BBS.  I don't remember the filename, but it was written
by a 'consortium' of TSR developers who are trying to bring sanity to
this whole can o' worms.  The name of that group is TeSeRact.  This may
also be the name of the file.  It has been quite a while, but I think
I opted not to use their approach, as the former seemed more robust.
-- 
Thayne Forbes
thayne@unislc.slc.unisys.com
Newsgroups: comp.lang.c
From: scs@adam.mit.edu (Steve Summit)
Subject: Re: quick addition using char and shorts....
Organization: none, at the moment
Date: Mon, 14 Dec 1992 04:57:12 GMT

In article <1992Dec10.154834.8349@news2.cis.umn.edu>, peschko@barracuda.micro.umn.edu (Edward Peschko) writes:
> I am writing an application in which both time AND memory are important....
> (well, memory is more important... I am working on a massively parallel 
> environment in which each processor has only 64K).

You know, once upon not all that long a time ago, large
applications (including the first compiler for this group's
namesake language) and entire operating systems (including the
fairly popular one often associated with that language) were
written for machines with 64K, or even smaller, address spaces,
so I'm not sure how onerous I'd consider this limitation,
especially since you presumably have a total of 64K times
whatever massive number of processers there are.

In any case, for a well-designed processor, it probably doesn't
take much more time to do a full-word add than a short or byte
add (if there are even narrow arithmetic operations available at
all), nor does it probably take much more time to fetch-a-byte-
from-memory-and-extend-it-to-a-word than it does to fetch-a-word-
from-memory.

Certainly, though, this is an example of a classic space/time
tradeoff: if you care more about speed, store the size for which
computation is most efficient; but if you care more about space,
prepare to sacrifice some time spent doing conversions.

					Steve Summit
					scs@adam.mit.edu
Newsgroups: comp.lang.c
From: eager@eagercon.com (Michael J. Eager)
Subject: Re: More File read problems. Help I'm new and confused...
Reply-To: eager@eagercon.com
Organization: Eager Consulting
Date: Sat, 19 Dec 1992 18:18:40 GMT

In article 1gl9bhINN3f7@mirror.digex.com, jhurwitz@access.digex.com (j. hurwitz) writes:
>
>-------------------------- cut here -------------------------
>
>//programm to read a C source file and verify # of left to right braces
>#include <stdio.h>
>
>int main(int argc, char *argv[])
>{
>   FILE *fptr;
>   int l=0, r=0, b=0, j=0;
>   char ch;

Change this to int ch.  EOF is usually a value that cannot be stored in a char.
You will usually hang at the end of the file.

>
>   fptr  = fopen("chkbrac.c","r");
>
>   while ((ch =getc(fptr)) !=EOF)
>	 {
>	 j=0;
>	 switch (ch)
>	   {
>	   case '{': b++;
>		            break;
>	   case '}': b--; 
>		            break;
>	   case '/*': while(j==0)
>			    { (ch=getc(fptr)); if (ch='*/') j=1; }

		^^^^                                  ^^^^
First, ch will be one character, not two.  Second, the compiler is probably 
generating a 16-bit value for the case, so you will never execute this case.

You need to have a case for '/' and then, if the next character is a '*' skip
until you get a '*' followed by a '/'.

>			    break;
>	   case '\'': while(j==0)
>			    { (ch=getc(fptr)); if (ch='\'') j=1; }

Better coding style (at least more ideomatic) is
			while (getc(fptr) != '\'') ;
No unneeded variables used.

>			    break;
>	   case '\"': while(j==0)
>			    { (ch=getc(fptr)); if (ch='\"') j=1; }
>			    break;
>	   }                     /* Junk to test program */
>	 }                       /* { {{{ '}' "}..."*/
>   if (b==0)
>	printf("\nBraces match !!!\n");
>   else printf("\nBraces do not match\n");
>   fclose(fptr);
>}


Other than this, the program seems to work.  It ignores comments, as 
mentioned above, but doesn't seem to have any other problems. 



---
Michael J. Eager		Michael.Eager@eagercon.com
Eager Consulting		(415) 325-8077 
1960 Park Boulevard, Palo Alto, CA 94306-1141

Newsgroups: comp.lang.c
From: s9100786@cumulus.csd.unsw.oz.au (Matthew Jackson)
Subject: ISAM routines
Reply-To: M.Jackson@unsw.edu.au
Organization: School of Banking and Finance, University of New South Wales
X-Newsreader: TIN [version 1.1 PL8]
Date: Wed, 16 Dec 1992 01:47:57 GMT

Does anyone know of any routines to implement ISAM under C ? We are 
working on a project which needs indexed sequential access and (as 
always) don't want to reinvent the proverbial wheel.

I checked archie for isam and no luck.

Thanks for any help,

--
Matthew Jackson                       | Computing Officer
M.Jackson@unsw.edu.au                 | School of Banking and Finance
61-2-697-3553                         | University of New South Wales
                                      | Sydney, Australia
From: sakamoto@sm.sony.co.jp (Tomohiko Sakamoto)
Newsgroups: comp.lang.c
Subject: Re: Date -> Day of week conversion
Date: 15 Dec 92 02:18:18 GMT
Reply-To: sakamoto@sm.sony.co.jp
Organization: Workstation Div., Supermicro Systems Group, Sony Corporation

In article <Bz3I8K.LDJ@ccu.umanitoba.ca>,
        ummalik@ccu.umanitoba.ca (Ijaz Rashid Malik) says:
> 
> Could someone please forward me algorithm to convert the date (in dd.mm.yy
> or yy.mm.dd format, but assume individual fields can be obtained as integers)
> to corresponding day of the week.

Please try this:
/*
 * 1 <= m <= 12,  y > 1752 (in the U.K.)
 */
dayofweek(y, m, d)
{
	y -= m < 3;
	return (y + y/4 - y/100 + y/400 + "-bed=pen+mad."[m] + d) % 7;
}

--
T. Sakamoto
Newsgroups: comp.lang.c