HDTenEightyP/NetNews huggingface dataset:
From: lwv26@cas.org (Larry W. Virden)
Subject: Re: Sun Spots recently sighted on Earth (was: Re: Simple C question)
Followup-To: comp.lang.c
Reply-To: lvirden@cas.org (Larry W. Virden)
Organization: Nedriv Software and Shoe Shiners, Uninc.
Date: Wed, 26 Aug 1992 12:07:52 GMT

In article <l9kpjiINNfof@jethro.Corp.Sun.COM> wsanders@ffeine.Sun.COM (Wiley Sanders) writes:
:a) ANSI        ANSI C plus Sun C compatibility  extensions,  with
:               semantic  changes required by ANSI C.  Where Sun C
:               and ANSI C specify  different  semantics  for  the
:               same  construct,  the compiler will issue warnings
:               about the conflict and use the ANSI C  interpreta-
:               tion.
:

Anyone know what theyse compatibility extensions are?
-- 
Larry W. Virden                 UUCP: osu-cis!chemabs!lvirden
Same Mbox: BITNET: lvirden@cas  INET: lvirden@cas.org
Personal: 674 Falls Place,   Reynoldsburg, OH 43068-1614
America Online: lvirden@aol.com
Xref: sparky comp.lang.c:13153 sci.math.num-analysis:2627
From: ajayshah@cis.rand.org
Newsgroups: comp.lang.c,sci.math.num-analysis
Subject: There is an article on C numerical extensions in Dr. Dobbs Jnl
Date: 3 Sep 92 07:00:11 GMT
Reply-To: ajayshah@cis.rand.org
Organization: RAND, Santa Monica CA

It is a "NCEG status report" by Robert Jarvis, in the August 1992
issue of Dr. Dobbs Jnl.

        -ans.
From: gt5870c@prism.gatech.EDU (Noah White)
Newsgroups: comp.lang.c
Subject: Question about code in Kernighan and Ritchie book
Date: 23 Aug 92 23:38:54 GMT
Organization: Universal Exports


   I have been trying to learn C with Kernighan and Ritchie's books The C
Programming Language. In it on pages 16-18 there are some examples which
count characters, lines and words in input. I typed em in exactly but they 
do not appear to work, when I run them it takes in the input fine but doesn't
print anything out. As I am new to c I thought one of you net guru's could
help me out:


#include <stdio.h>
#define YES 1
#define NO  0

main()	/* count lines, words, chars in input */
{
	int c, nl, nw, nc, inword;

	inword = NO;
        nl = nw = nc = 0;
	while ((c = getchar()) != EOF)  {
            ++nc;
            if (c == '\n')
                ++nl;
            if (c == ' ' || c == '\n' || c =='\t')
                inword = NO;
            else if (inword == NO)  {
                inword = YES;
                ++nw;
            }
        }
        printf("%d %d %d\n", nl, nw, nc);
}
Newsgroups: comp.lang.c
From: jaime_guerrero@afs.com
Subject: Re: Why should POINTERS be so damn hard to understand ?
Reply-To: jaime_guerrero@afs.com
Date: Fri, 28 Aug 1992 15:32:07 GMT

In article <l9nl34INNhln@almaak.usc.edu> ajayshah@almaak.usc.edu (Ajay Shah)  
writes:
|  ...
|  On the contrary, I did a fortran --> basic --> pascal --> turbo pacal
|  --> awk --> C route.  I found that an Extremely crisp clarity
|  with Pascal pointers was a great asset in quickly jumping into
|  pointers with C.
|  ...
|  IMHO Pascal is still the best first teaching language I can see.
|  I would move on to C soon, but it's hard explaining C to someone
|  who has never written programs before.  If you have not laboured
|  writing x = x + 1; thousands of times, you won't appreciate
|  ++x and x++.
|  -- 
|  Ajay Shah, (213)749-8133, ajayshah@usc.edu

Bravo.

IMHO, pointers are not at all hard to understand if you initially avoid their  
more confusing aspects like pointer arithmetic and simply deal with them as  
literal pointers/handles/references to other objects.

Drawing those silly little diagrams with boxes and arrows is essential- it  
makes the idea of a pointer really obvious.

Learning Pascal first also helps a lot, since it only allows pointers as  
object references; the weird stuff like pointer arithmetic is not allowed.

After much such experience you can then graduate to the fun and dangerous  
school of pointer manipulation.

Though it was unplanned, the sequence in which I learned languages over 11  
years helped me considerably to understand increasingly complex concepts:

BASIC             variables, loops
Fortran           subroutines with arguments
Pascal            data structures, recursion, pointers, structured programming
C                 modularity, general purpose reusable functions
Assembly          really understanding pointers and local (stack) variables
C++, Objective-C  object orientation, runtime binding

I think newcomers can skip BASIC and Fortran (they often encourage bad habits)  
and go right to Pascal.  Learning C is a relative snap if you're competent in  
Pascal.

--
Jaime F. Guerrero                              "How well do we use
Anderson Financial Systems, Inc.                The freedom to choose
Springhouse, PA, USA                            The illusions we create?"
jaime@afs.com          [NeXTmail accepted]      -Timbuk 3
Newsgroups: comp.lang.c
From: g89r4255@hippo.ru.ac.za (Lt Sajid Rahim)
Subject: Require code for the micro-c compiler.
Summary: Require code for the micro-c compiler.
Keywords: Require code for the micro-c compiler.
Organization: Rhodes University, Grahamstown, South Africa
Date: Wed, 26 Aug 1992 06:55:28 GMT


Hi,

I am working on a small compiler project. I need to get hold
of the source code for Micro-C compiler. Does anybody outthere
have a copy and is will to send it across uuencoded.

Appreciate all the help.

Sincerely

Sajid

-- 
---------------------------------------------------------------------
--   Sajid Rahim, Dept of Computer Science, Rhodes University,     --
--   Grahamstown, South Africa. Internet : g89r4255@hippo.ru.ac.za --
---------------------------------------------------------------------
Newsgroups: comp.lang.c
From: alpha@wyvern.twuug.com (Joe Wright)
Subject: Re: HELP !! Converting non printable characters to HEX
Organization: Box 68621, Virginia Beach, 23455
X-Newsreader: Tin 1.1 PL4
Date: Thu, 3 Sep 1992 13:48:27 GMT

u8705957@cs.uow.edu.au (Hitesh Sanghvi) writes:
: Hi there;
: 	Any suggestion or 'c' code on how to convert non printable 
: characters to hex.
: My function works for printable ascii characters but does not work
: on non printable characters.
: 
ctoh(c, h) char *c, *h; {
	static char a[] = "0123456789ABCDEF";
	*(h+1) = a[*c & 017];
	*h = a[*c >> 4 & 017];
}

-- 
Joe Wright  alpha@wyvern.twuug.com    
Newsgroups: comp.lang.c
From: edb1@cbnewsf.cb.att.com (edward.benyukhis)
Subject: Re: Memory alignment of struct elements
Organization: AT&T
Date: Tue, 1 Sep 1992 17:15:27 GMT

In article <25533@dog.ee.lbl.gov> torek@horse.ee.lbl.gov (Chris Torek) writes:
>In article <adam.714060134@mcrware> adam@microware.com (Adam Goldberg) writes:
>>That's all well and good, but what if, say, you are coding an implementation
>>of LIM EMS 4.0, which takes as a parameter a structure which, in assembler,
>>looks like [radically machine-dependent example omitted].
>
>>Is there any standard way to FORCE the C Struct to be identical to the
>>Asm struct?
>
>Well, obviously if you are talking about coding for compatibility with
>a specific assembler interface, you are throwing portability off the
>top of the Sears Tower (never to be seen again), so you buy the C
>compiler that comes with the appropriate compilation directives---as
>compile-time options or `__packed' keywords or #pragma's or whatever
>---and use those.
>
>To paraphrase a famous statement, ``If you want assembly language, you
>know where to find it.''  It is no good asking for C to be portably
>nonportable.  Some machines---like the ones I use---are physically
>incapable of accessing unaligned data.  (It causes a machine fault.)
>-- 
>In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 510 486 5427)
>Berkeley, CA		Domain:	torek@ee.lbl.gov






An example of such is a Motorola 68000 world alignment is mandatory
and is dictated by the architecture of the microprocessor.  Both
code and data must be aligned on the word boundary.

Just my 2 cents worth.

Ed
From: ddewar@cbnewsb.cb.att.com (derek.a.dewar)
Newsgroups: comp.lang.c
Subject: mmap example
Date: 4 Sep 92 10:42:16 GMT
Organization: AT&T

Does anyone out there, have an example of some code, whereby you could
map some data values (integers, say) into memory using mmap, and assign
those values to some integer variables in the program...

An unusual request I know....

Thanks in advance,

Derek
----
Derek A. Dewar
AT&T Network Systems Uk Ltd.

E-Mail : ddewar@ihlpb.att.com
Newsgroups: comp.lang.c
From: leander@rkw-risc.cs.up.ac.za (Leander Conradie)
Subject: Concurrent C wanted
Date: 28 Aug 92 17:59:03 GMT
Organization: University of Pretoria, South Africa

Does anyone know a PD implementation of Concurrent C/C++? Any FTP sites where
one could download such a thing? Any help would be appreciated.
  
     
Thanks in advance

Leander Conradie
---------------->
leander@up.ac.za
From: barmar@think.com (Barry Margolin)
Newsgroups: comp.lang.c
Subject: Re: dynam mem alloc
Date: 26 Aug 1992 16:18:38 GMT
Organization: Thinking Machines Corporation, Cambridge MA, USA
NNTP-Posting-Host: telecaster.think.com

In article <MJN.92Aug26015009@pseudo.uucp> mjn@pseudo.uucp (Murray Nesbitt) writes:
>ecm@casbah.acns.nwu.edu (Edward Malthouse) writes:
>>int *x;
>>if(n == NULL) /* memory has not been allocated */

Where did "n" come from?

>>This works fine as long as the pointer variable was declared as global or in
>>main().  If it is declared elsewhere this statement does not work.  For
>>example:

>Yes, there is a portable way.  Use the storage-class specifier
>``static''.

That's not a good answer, since it has more effects than just solving this
problem.  Besides being initialized to 0 automatically, static variables
also retain their value across calls.  So if he frees the object before
returning from the function, the next time he comes in he'll think that the
memory has already been allocated (or worse, since doing anything with a
pointer to freed storage is a no-no).

He should just provide an explicit initializer:

int *x = NULL;

BTW, the fact that it is automatically initialized in main() is just a
feature of that particular implementation.  There is no required default
initialization of automatic or register variables, so you should always
provide an initializer if you care.

-- 
Barry Margolin
System Manager, Thinking Machines Corp.

barmar@think.com          {uunet,harvard}!think!barmar
Newsgroups: comp.lang.c
From: tel1568@tamsun.tamu.edu (Tom Landrum)
Subject: Delete volume label?
Organization: Texas A&M University, College Station
Date: Sat, 29 Aug 1992 19:49:06 GMT


Does anybody know how to delete a volume label on a diskette using
Borland C++ 2.0?  I've tried changing the file attribute with _chmod
but I get errno set to access denied.

Thanks
-- 
****  Tom Landrum
****  tel1568@tamsun.tamu.edu
****
****  The perversity of the universe tends toward a maximum. - Niven
Newsgroups: comp.lang.c,comp.lang.c++
From: prechelt@i41s14.ira.uka.de (Lutz Prechelt)
Subject: Software Metrics Tools available ?
Organization: University of Karlsruhe, FRG
Date: Thu, 27 Aug 1992 11:31:55 GMT

Does anybody know of any freely available tools that compute
some software metrics for C or C++ programs ?

I am thinking of such things as numbers of operators/operands/controls
per function/file/statement and so on.

Please reply by email, I'll summarize to the net.

  Lutz

-- 
Lutz Prechelt   (email: prechelt@ira.uka.de)            | Whenever you 
Institut fuer Programmstrukturen und Datenorganisation  | complicate things,
Universitaet Karlsruhe;  D-7500 Karlsruhe 1;  Germany   | they get
(Voice: ++49/721/608-4317, FAX: ++49/721/694092)        | less simple.
From: fjh@mundil.cs.mu.OZ.AU (Fergus James HENDERSON)
Newsgroups: comp.lang.c
Subject: Re: C vs. FORTRAN
Date: 4 Sep 92 16:01:57 GMT
Organization: Computer Science, University of Melbourne, Australia

svec5@menudo.uh.edu (T.C. Zhao) writes:

>In article <1992Sep3.225136.27006@nrao.edu> cflatter@nrao.edu writes:
>>In article 92Sep3164036@spsd630a.erim.org, dwiseman@spsd630a.erim.org (Dave Wiseman) writes:
>>>
>>>Help!
>>>
>>>I have a (two) simple programs, one in fortran, and one in C.  I have compiled
>>>them both optimized, and timed the results.  The fortran version takes .1 s
>>>to run, and the C version takes 12.5s to run.  I know (hope) that there is a
>>>	Dave Wiseman
>>>	dwiseman@erim.org
>>>
>>
>>Beware of timing trivial programs.  Since the first 999 999 values of the_sin
>>and the_cos are discarded an optimised is at liberty to avoid computing them.
>>It is likely that the FORTRAN compiler did this and while the C compiler
>>did not.  I am fairly sure that if the_sin and the_cos were made into arrays
>>and if the sin and cos results were stored into the_sin(i) and the_cos(i)
>>on every loop the C and FORTRAN versions would take almost exactly the
>>same time to run.
>>
>>The only other likely possibility is that the FORTRAN compiler is exploiting
>>a hardware implementation of the transcendental functions while the C compiler
>>is not.  This is only a significant possibility on Intel 80x86/80x87 machines
>>and since the 0.1 second time for the FORTRAN implies a floating-point
>>performance in excess of 30 MFLOPS it is a very remote one.
>>
>>	Chris Flatters
>
>Yet another possibility (although it won't explain the huge difference):
>Fortran compiler knows the sin and cos functions and hence there is
>a possibility to do inlining while C compiler is not aware of these
>functions and there is no possibility of doing so without violeting
>the standard.

This is quite simply false. Although inlining mathematical functions
is the sort of optimization that a Fortran compiler is more likely
to make than a C compiler, the C compiler may be quite aware of
the sin/cos functions and is quite capable of inlining them without
violating the standard. Many C compilers do exactly this for simple
functions such as memcpy().

See the recent discussion regarding inlining of pow() on
comp.lang.fortran / comp.std.c.

-- 
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!
From: Corey.Roome@mixcom.mixcom.com (Corey.Roome)
Newsgroups: comp.lang.c
Subject: Smartdrv attacks the Memory (protected mode ?) Assembly Code...
Date: 25 Aug 92 15:19:45 GMT
Article-I.D.: mixcom.1992Aug25.151945.21928
Distribution: usa
Organization: Milwaukee Internet Xchange BBS, Milwaukee, WI U.S.A.


111 000 111   111 000 111 Digtal Distress Call... 

Save ME !

I can only do this instuction with Smartdrv Loaded why ?


        mov ax,[ds:ecx]



If you can help me please write to Corey.Roome@Mixcom.com

If you can help me I will greatly reward you.  Thanks !


-- 
Corey.Roome@mixcom.com
Newsgroups: comp.lang.c
From: rickan@maccs.dcss.mcmaster.ca (Mark Rickan)
Subject: Initializing Random Seeds 
Organization: Department of Computer Science, McMaster University
Date: Fri, 4 Sep 1992 17:32:59 GMT

Please excuse me if this is a FAQ, but is there a ANSI-compliant means
of initializing a random seed which has a reasonably low probability
of recurring? At the moment, I'm using srand in conjunction with
time(&t). Unfortunately, on a fast machine, the time delay is often
< 1 second, resulting in the production of the same random value.

I've avoided this problem by use of a time delay, but I'm convinced
that there must be a more elegant and efficient means of doing this.

Any suggestions would be appreciated,

Mark

-- 
 -------------------------------------------------------------------------
 = Mark Rickan                         ...!uunet!utai!utgpu!maccs!rickan = 
 = DCSS, McMaster University               rickan@maccs.dcss.mcmaster.ca = 
 ------------------------------------------------------------------------- 
Newsgroups: comp.lang.c
From: steve@taumet.com (Steve Clamage)
Subject: Re: MS-C fread bug
Organization: TauMetric Corporation
Date: Fri, 4 Sep 1992 15:17:59 GMT

a_rubin@dsg4.dse.beckman.com (Arthur Rubin) writes:

>In <1992Sep3.141100.28778@wuecl.wustl.edu> drm4005@wuee1.wustl.edu (David Russell Maffitt) writes:

>>Here is a simple piece of code that does not work under MS-C versions ...
>>What is magic about the value 70.689651???  ...

>MAGIC has a byte which has the value 0x1A, which is processed as an end of
>file by MS-DOS.  If you open fp2 in mode "rb" instead of "r", there is no
>problem.

This deserves a bit of explanation.

When you open a file with the "r" or "w" mode, you tell the C runtime
library, and thus the file system, that you are reading or writing
a text file.  If you then read or write binary data, you may well
get bizarre results.  Maffitt found one such.  There are other things
which can happen, such as mapping to and from what appear to be CR-LF
sequences but which are intended to be just binary bytes of data.

When you input and ouput binary data, you need to tell the runtime
system that you want a binary rather than a text file.  The "rb"
and "wb" in the mode parameter to the "fopen" function do just that.
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
Vice Chair, ANSI C++ Committee, X3J16
From: fab9452@nigel.tamu.edu (Allan Bailey)
Newsgroups: comp.lang.c
Subject: Hungarian notation paper/article reference request
Date: 31 Aug 92 21:01:03 GMT
Distribution: comp
Organization: /home/fab9452/.organization


  Can someone please post or email me a reference to where I can find
an article or book about the Hungarian notation that was discussed
a month or two ago?

thanks,
allan bailey
fab9452@nigel.tamu.edu
--
Allan Bailey, UNIX/HURON programmer, CSC
fab9452@nigel.tamu.edu

quote of today:

  "They say Confucious does his crosswords with a pen."
                                --Tory Amos, "Little Earthquakes"
From: dgil@pa.reuter.COM (Dave Gillett)
Newsgroups: comp.lang.c
Subject: Re: pointer to araay of structs
Keywords: pointers
Date: 27 Aug 92 14:13:36 GMT
Organization: Reuter:file Inc  (A Reuter Company) Palo Alto, CA

In <BtICrz.5pB@orfeo.radig.de> eric@orfeo.radig.de (Eric Tuerlings) writes:

>struct aaa {
>    char y;
>    char z;
>}

>void func (struct aaa (*bbb)[])
>{
>    char z;
>
>    z = bbb[3]->ccc;
     z = bbb[3]->y;  /* ccc is not a member of struct aaa */
>}

1.  void func( struct aaa *bbb )

     bbb is a pointer to a struct aaa.  bbb[0] is that struct, bbb[1] is another
     struct aaa, which follows it contiguously in memory (modulo struct array
     alignment padding).

2.  void func( struct aaa **ccc )
     ccc is a pointer to a pointer like bbb above.  ccc[0] is that pointer;
     ccc[1] is another one following it, and so on.  I've routinely used this
     to pass arbitrary numbers of arrays to a function, where some ccc[n]==NULL
     marks the end of the list of arrays.  This is *probably* what you had in
     mind.

3.  void func( struct aaa ( *bbb )[] )
     bbb is a pointer to a bunch of aaa structs.  bbb[0] is the array; bbb[1]
     is another array, the same size as the first, following it in memory, and
     so on.  So to find bbb[1], the machine needs to add an offset to bbb
     (&bbb[0]) based on the size of the arrays which are bbb[0], bbb[1], etc.
     The compiler complains, quite correctly, when you don't tell it that
     size.  If this is really what you want, you must either make your arrays
     of fixed size or pass a size parameter and a 'raw' pointer to func, and
     have it do its own pointer arithmetic and cast the results.  (Ughh!)

     Here we see the wisdom of the FAQ's admonition, when speaking of pointers
and arrays, to avoid using array notation in function declarations.

                                              Dave Gillett
From: bkuhn@rhlab.UUCP (bmk Bradley Kuhn)
Newsgroups: comp.lang.c
Subject: Re: Why should POINTERS be so damn hard to understand ?
Summary: C as a first language
Date: 28 Aug 92 13:39:27 GMT
Organization: Baltimore Rh Laboratory, Inc., Maryland

In article <l9nl34INNhln@almaak.usc.edu>, ajayshah@almaak.usc.edu (Ajay Shah) writes:
> tony@nexus.yorku.ca (Anthony Wallis) writes:
> 
> >Jim Sullivan (sullivan@alw.nih.gov), in response to  
> >> > When learning C, what things did you find the most
> >> > confusing/difficult to understand?
> >says
> >> What else?... POINTERS!
> 
> >(This seems to be a common gripe from students subjected to that
> > Blaise-ing insult known as "Pascal" too.)
> 
> On the contrary, I did a fortran --> basic --> pascal --> turbo pacal
> --> awk --> C route.  I found that an Extremely crisp clarity
> with Pascal pointers was a great asset in quickly jumping into
> pointers with C.

I took the: basic --> pascal (but never learned pointers) --> C (w/pointers)
            --> pascal (w/pointers)   route.

> Most pascal students don't have time enough in a first course to
> really think about pointers.

IMHO, I think it is best to get right into linked list and pointers right after
learning arrays.  The constrast w/ arrays shows the value of pointers/linked
lists, and it is easiest to see when the student has the concept of arrays
and direct acess memory storage fresh in the mind.

> IMHO Pascal is still the best first teaching language I can see.

I think that it is time to switch to C (Wirth would tell us Modula-2 :-).
Pascal became a first language when it was the most popular language in use.
C is now the most popular, and it's time as an introductional language has 
come. Pointers could be held off until a second level course, and then the
student is not so overwhelmed by the C, since the basic concepts are already
in place, and the advanced concept of pointers can be more in focus.
  Actually, I found it to be quite a let down, after mastering C, to return
and finish pascal (I learned C on my own, and they made me take the extra
pascal).  I remember the day in class that pointers were introduced, I thought
to myself "THAT'S IT!  HOW USELESS!"

> If you have not laboured
> writing x = x + 1; thousands of times, you won't appreciate
> ++x and x++.

Granted, there is something to be said for that.  I remember first learning
differential calculus.  We had 40 problems to find derivatives using the
limit definition.  It took me 4 hours.  The next day, the teacher told us
to " multiply by the power and drop it one".  I was P.O.'d but I will never
forget the limit definition of a derivative.

That being said, I think that there is a point where we have to give 
rookies the advantages of our labors.  We don't make First year students in
CS write assembler code before they are permitted to use high-level languages.
-- 

 -- Bradley M. Kuhn    Computer Systems Development, Inc.
     INTERNET: rhlab!bkuhn@uunet.uu.net OR bkuhn@loyola.edu
     UUCP:     ...uunet!rhlab!bkuhn
Newsgroups: comp.lang.c
From: steve@taumet.com (Steve Clamage)
Subject: Re: How is NaN recognized?
Organization: TauMetric Corporation
Date: Sun, 30 Aug 1992 16:29:09 GMT

6500mack@ucsbuxa.ucsb.edu (Michael P. Mack) writes:

>I am using scanf() to read in a float that is entered by the user.  If
>an invalid string is typed such as "-" or "." then the variable is
>assigned -0.NaN(DFD5480000000000... or -0.NaN(DFD9400000000000000...

>How do I detect when the float is a NaN so that I can set it to 0.0?

There is no portable way to do this, since it is not part of the C
langauge.  If you C implemenation supports NaN's, as it seems to,
it should document how to detect them.

Check your manuals or man pages under <float.h>, <math.h>, floating-point
or ieee.  There should be a function called something like "isnan".
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
Vice Chair, ANSI C++ Committee, X3J16