HDTenEightyP/NetNews huggingface dataset:
From: carl@syscon.rn.com (Carl Kreider)
Newsgroups: comp.lang.c
Subject: Re: Why should POINTERS be so damn hard to understand ?
Date: 3 Sep 92 15:40:38 GMT
Article-I.D.: syscon.1992Sep03.154038.27377
Organization: Syscon Corporate Headquarters - South Bend, IN USA

ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes:

>In article <1992Aug28.012406.3698@ttinews.tti.com>, reid@metis.tti.com (Reid Kneeland) writes:
>> True.  If you think of C as a preprocessor for the PDP-11 assembler, it
>> makes a lot more sense.

>Of course, if you _do_ think of C that way, you will be committing the
>sin of anachronism.  Most of C's control structures are copied from BCPL
>(designed for word-oriented machines) except that BCPL had separate BREAK
>and ENDCASE statements, and C confounds the two; C's update operators were
>very popular at the time it was designed and were mostly present in Algol 68
>(C didn't copy the PRUS operator though).  The PDP-11 was _not_ the first
>machine C ran on, nor the machine C was designed for.

Certainly true, but I thought that "*p++ = *s++" derives directly from
"mov (r0)+,(r1)+" for example.  In that sense C is high level assembler.
-- 
Carl Kreider       Usenet    uunet!rde!gator!syscon!carl
CIS  71076,76      Internet  carl@syscon.rn.com
From: jfw@ksr.com (John F. Woods)
Newsgroups: comp.lang.c
Subject: Re: strcpy implementation question
Date: 28 Aug 92 17:19:42 GMT

fjh@cs.mu.OZ.AU (Fergus Henderson) writes:
>curt@watson.ibm.com (Curt McDowell) writes:
>>It better work on your machine.  "unused" is legally allocated local stack
>>space, so of course you can reference it.  Since the initial contents are
>>undefined, the result unused[0] is undefined.  Fine.
>Well, NOT fine, if you were trying to write strictly conformant ANSI
>C code. An ANSI C implementation is well within its rights to dump core
>if you reference uninitialised memory

Can you provide a reference for this?  I thought so too, but when I looked
through the standard to back up MY reply, I found only the stipulation that
uninitialized automatics have an "indeterminate" value; I couldn't find
any permission for that value to cause any trouble.
From: chas@castle.ed.ac.uk (C Spencer)
Newsgroups: comp.lang.c
Subject: Re: Why should POINTERS be so damn hard to understand ?
Date: 27 Aug 92 07:34:44 GMT
Organization: Edinburgh University


Why does a pointer need to know what it's pointing to? Surely it's just
an address - if there was only one kind of pointer, there wouldn't be so
much to learn, and be confused by.

-- 
Chas Spencer			email :	Chas@ed.ac.uk
User Support, EUCS
University of Edinburgh
From: s3007588@MACKAY.MPCE.MQ.EDU.AU
Newsgroups: comp.lang.c
Subject: Problem with system function and CSH.
Date: 5 Sep 92 00:38:21 GMT

G'day,
	I have been trying to work out how to pass a
command (using the 'system' function) to the CSH instead of 
the standard shell. I experimented with redirection , 
	i.e. system("csh < blah"),
but didn't figure it out.
	Any help would be appreciated.


				Allen McAuley,
				s3007588@mackay.mpce.mq.edu.au

p.s Just in case it helps, my environment is:
	SunOS Release 4.1.1 
	running on sparc ipc's.

p.p.s. a mail response would be better than through this news
	group, but whatever is easiest is fine.. Thanks.
From: jos@and.nl (Jos Horsmeier)
Newsgroups: comp.lang.c
Subject: Re: How is NaN recognized?
Date: 30 Aug 92 13:00:02 GMT
Organization: AND Software BV Rotterdam

In article <5569@ucsbcsl.ucsb.edu> 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?

Don't use scanf() for this, use a combination of fgets(), to read a line
and atof() to convert the input string to a double value. atof() returns
0.0 if the string could not be converted to a double value and it
sets (I'm not sure if all implementations do this) the errno variable
to ERANGE in case of overflow.

If you realy want to play it on the safe side and control all the
keystrokes from the user, you can implement a small DFA to scan the
incoming characters. I think (I didn't test it) the following DFA
could do the job for you:

			+   -  <d>  .   e
		      +---+---+---+---+---+
		    1 | 2 | 2 | 2 | 3 |   |
		      +---+---+---+---+---+
		    2 |   |   | 2 | 3 | 4 |
		      +---+---+---+---+---+
		    3 |   |   | 3 |   | 4 |
		      +---+---+---+---+---+
		    4 | 5 | 5 | 5 |   |   |
		      +---+---+---+---+---+
		    5 |   |   | 5 |   |   |
		      +---+---+---+---+---+


Note: <d> is any digit. State 1 reads an optional +/- sign or the first 
      digit or the decimal point. State 2 reads following digits, the
      decimal point or the exponent sign. State 3 reads the optional
      fraction part and state 4 and 5 read the exponent. All other
      (blank) entries indicate an error if the current keystroke is
      not a new line character, otherwise the input has been scanned
      successfully.

It's not difficult to implement the DFA described above, either in
tabular form or as one big switch statement.

I hope this helps a bit,

kind regards,

Jos aka jos@and.nl
From: tlg@uknet.ac.uk (Tim.Goodwin)
Newsgroups: comp.lang.c
Subject: Re: main()
Date: 3 Sep 92 17:27:27 GMT
Organization: UKnet

In article <1992Sep3.160001.13782@lclark.edu> harrison@lclark.edu
(Mark Harrison) writes:
>                                                                OK.  I now
>understand why it is important not to declare 'void main()'.  I never
>thought of it before.  But two people have now told me to try it with -A
>and -P.  Why?  I don't really need to satisify my curiosity about 'void
>main()'.  So is there another reason I would want these switches?

It seems that the readers of this group are interested in C, as defined by
the ANSI/ISO standard, and not in other languages which happen to look
like C (as, for example, the language which your compiler compiles).

There are some, perhaps, who are overkeen to correct those who do not share
this fascination with the standard.  But they are not trying to "score a
point off you", merely attempting to disseminate accurate information.
Many of them are the same people whose posts make this a worthwhile group
to read.

>                                                                   My
>program would most definatly not be portable.  I'm writing a GUI for DOS
>and I doubt that it would run without major modifications on another
>system.  And I am very happy with Borland's product, and don't see myself
>switching in the near future. 

Not even to the next release of the compiler?  Unless this is a documented
extension, you should not rely on it.  [ Damn - I'm doing it myself now.
This should not be taken to mean that my posts contribute to the quality of
the group :-). ]

Tim.
-- 
perhaps if people had understood fork() better we | ; who am i
wouldn't have threads - Rob Pike.                 | uknet.ac.uk!tlg
From: reid@metis.tti.com (Reid Kneeland)
Newsgroups: comp.lang.c
Subject: Re: Why should POINTERS be so damn hard to understand ?
Date: 28 Aug 92 01:24:06 GMT
Organization: Transaction Technology Inc.

In article <1992Aug26.183054.14146@newshub.ccs.yorku.ca> tony@nexus.yorku.ca (Anthony Wallis) writes:

>How can you understand C without understand what C is a convenience
>replacement for ?

True.  If you think of C as a preprocessor for the PDP-11 assembler, it
makes a lot more sense.

(I hope someone will flatter me by using this as a .sig quote...)

=====================================================================
Reid Kneeland
reid@ttidca.tti.com  (that's MISTER reid@ttidca.tti.com to you!)
{philabs,psivax,pyramid,quad1,rdlvax,retix,rutgers}!ttidca!reid
Transaction Technology Inc., Santa Monica, CA, USA (310) 450-9111 x2499
The opinions expressed above do not necessarily etc etc...

Never trust a man who can count to 1,023 on his fingers.
Newsgroups: comp.lang.c
From: alpha@wyvern.twuug.com (Joe Wright)
Subject: Re: main()
Organization: Box 68621, Virginia Beach, 23455
X-Newsreader: Tin 1.1 PL4
Date: Fri, 4 Sep 1992 01:27:25 GMT

All functions return some value to the caller.  The default type
of this value is int.  Typing a function which returns an int is
perhaps good style but is unnecessary.

"foo() { return 0; }" and "int foo() { return 0; }" are equivalent.

main() is a function.  It returns an int to its caller.  You may
write it "main() {}" or "int main() {}" as you like.

I suppose that "void foo() {}" does not affect the compiler at all.
The void type is simply a clue to 'lint' or whatever that you will
not use the return value and not to bug you about its non-use.

"void main()" would declare that /bin/sh will not use the return value
from main.  A very bad assumption.
-- 
Joe Wright  alpha@wyvern.twuug.com    
Newsgroups: comp.lang.c
From: draper@ais.org (Patrick Draper)
Subject: Re: Reading PC CMOS using Borland C
Keywords: CMOS C
Organization: UMCC
Date: Thu, 27 Aug 1992 22:33:45 GMT

In article <$dougn.8.0@sasb.byu.edu> $dougn@sasb.byu.edu (Douglas R. Nebeker - MIS_SAS) writes:
>Hello 
>
>I posted this earlier, but asked the wrong question--my appologies to those 
>that read it...here's the real thing:
>
>I am using Borland C and trying to read the CMOS in my PC.  Does anyone have 
>any experience doing this?  Do I need to read from a port?  Any hints or 
>help would be very welcome.
>
>Thanks
>
>___
>Douglas R. Nebeker                             Internet: $dougn@sasb.byu.edu
>Brigham Young University
>SAS Computer Support

One thing that helps is to put extra intructions in the code to take up
time. The CMOS is read by sending data out a port, then reading aonther
port. Right after you send the first byte out your port, delay a couple
milliseconds to let things settle down in the hardware, then go ahead and do
your read.

Ahhhhhh! The things that just aren't written in books will astound you!


------------------////////////////////\\\\\\\\\\\\\\\\\\\\------------------
| Patrick Draper           Disclaimer:  I can't control my fingers,        |
| draper@umcc.ais.org                   I can't control my toes! - Ramones |
| University of Michigan                                                   |
| Computer Club                We are a nation of laws, not people         |
------------------\\\\\\\\\\\\\\\\\\\\////////////////////------------------
Newsgroups: comp.lang.c
From: Ketan.Deshpande@bbs.oit.unc.edu (Ketan Deshpande)
Subject: Re: Most difficult part of learning C?
Organization: Extended Bulletin Board Service
Date: Tue, 25 Aug 1992 18:09:19 GMT

In article <9208251159.AA04122@ult4> goldstei@cgi.com ("Morris Goldstein") writes:
>I am conducting research for a little project concerning difficulties in
>learning C and how to improve the teaching of C so as to circumvent these
>problems.
>
>When learning C, what things did you find the most confussing/difficult to
>understand?
>
>        -Morris
>
>(goldstein@cgi.com)

The most difficult thing for me was to understand that given a declaration
like
 int a[10];

both the following are correct:
   a[6] =  ....;
   6[a] = ....;

One person made the comment,' so much for learning a higher level language
before C'.
While that may be debated, there is some truth in it.
That's my $0.02 worth.
Ketan.

--
   The opinions expressed are not necessarily those of the University of
     North Carolina at Chapel Hill, the Campus Office for Information
        Technology, or the Experimental Bulletin Board Service.
           internet:  bbs.oit.unc.edu or 152.2.22.80
Newsgroups: comp.lang.c
From: amn@unix.brighton.ac.uk (Anthony Naggs)
Newsgroups: comp.lang.c,comp.os.msdos.programmer
Subject: Re: WANTED: Code to search DOS directory/subdirectories
Date: 28 Aug 92 23:50:22 GMT
Reply-To: amn@vms.brighton.ac.uk
Organization: University of Brighton, England

Robert C Allender, <rca@csd4.csd.uwm.edu>, asked a number of questions:
> I'm trying to find a reasonable block of code that will search through a DOS
> directory using Turbo C 3.0 in DOS mode.  I had what I thought was a good
> source listing in the C User's Journal - February 1992 edition, but it won't
> compile to save my life.  Has anyone else tried this code?

I can't comment, as my copy is somewhere amongst all the other mags under
the desk.  The example you give looks okay.

>      { ...
>
>        struct find_t ffblk;
>        int done;
>        printf("Directory of C:\\\n");
>        done = _dos_findfirst("C:\\*.*",_A_SUBDIR,&ffblk);
>        while(!done)
>        {
>           printf(" %s\n", ffblk.name);
>           done = _dos_findnext(&ffblk);
>        }
>        return 0;
>
>      } ...
>
> the _A_SUBDIR is supposed to return only DOS subdirectory entries, however it
> seems to (as do the other alternatives) also return normal files that are  in
> the same directory with the directory entries.

There are many books which state this, they are *wrong*.  As far as I remember,
(hedging a little), the attribute bits in the search mask have the following
effects:
Microsoft C names   Value   Effect
    _A_NORMAL       0x00    Find files with _A_RDONLY or _A_ARCH set
    _A_RDONLY       0x01    None (read-only files are found anyway)
    _A_HIDDEN       0x02    Also find Hidden files
    _A_SYSTEM       0x04    Also find System files
    _A_VOLID        0x08    Also find the volume label, (if present in search
                            directory) [see note below]
    _A_SUBDIR       0x10    Also find Subdirectories
    _A_ARCH         0x20    None (new, 'Archive', files are found anyway)

Note:
*   If _A_VOLID is the only bit set, then the search will only look in the
    root directory for the Volume label.  (The standard method of finding the
    volume label is to do an extended FCB search with just this attribute).

To only find subdirectories, for example, you would have to include them in
your search and then test the attributes of each file found.

> If anyone can help, I'd really appreciate it.

Hope this is useful, Anthony Naggs

Software/Electronics Engineer                   P O Box 1080, Peacehaven
                                                East Sussex  BN10 8PZ
Phone: +44 273 589701                           Great Britain
Email, (c/o Univ of Brighton): amn@vms.brighton.ac.uk
Newsgroups: comp.lang.c
From: katzn@mksol.dseg.ti.com (Neil M Katz)
Subject: GNU gcc Compiler Question
Organization: Texas Instruments, Inc
Distribution: usa
Date: Tue, 25 Aug 1992 14:51:42 GMT

I have a few questions about the GNU gcc compiler.

More specifically, I have found that when I compile a program
that refers to math functions such as pow or log10, I 
get the following message from gcc:
ld: Undefined symbol:
	_cos
	_asin
	_tan
collect: /usr/bin/ld returned 2 exit status

I have included math.h, but still get these errors.  Note that this
same file compiled successfully with Sun's acc compiler on
a SparcStation IPC.

What am I doing wrong?

Please post responses to this newsgroup or email me directly at
katzn@lobby.ti.com.       

Thanks,
Neil Katz
Newsgroups: comp.lang.c
From: hugie@beaufort.sfu.ca (Don Hugie)
Subject: Quick C for Windows
Summary: Does QuickC for Windows compile ANSI?
Keywords: Quick C
Organization: Simon Fraser University, Burnaby, B.C., Canada
Date: Thu, 3 Sep 1992 23:06:51 GMT

Hello,
  Does anyone out there have any experience with Quick C for Windows? 
Specifically, I'm interested in knowing if this compiler will compile
bare ANSI code.  I would like to have a Windows compiler but I have
ANSI code that I don't want to add Microsoft extenstions to. Thanks...


                                                 Don Hugie
                                                 Simon Fraser Univ.
                                                 Canada
 
                                                 hugie@sfu.ca
  
Newsgroups: comp.lang.c
From: mustafa@seas.smu.edu (Mustafa Kocaturk)
Subject: Re: Another simple C question
Summary: arrays and pointers
Keywords: array lvalue rvalue assignment
Organization: SMU School Of Engineering and Applied Science
Distribution: unm
Date: Sun, 23 Aug 1992 22:48:27 GMT


In article <!+-n84@lynx.unm.edu> rsahu@triton.unm.edu (Raikanta Sahu) writes:
>Here is another problem I am facing in compilation with our RISC compiler
>in triton @ unm.
>------------------------------------------------------------------------
>#include <stdio.h>
>
>main(argc, argv)
>int argc ;
>char *argv[] ;
>{
>
>  char infile[50] ;
>
> if(argc == 1)
> {
>    printf("Give input file : ") ;
>    scanf("%s", infile) ;

In order to avoid crossing array boundaries in the case of
`scanf' scanning strings longer than 49 characters,
I suggest that the `scanf' format string be modified as follows:

     scanf("%49s", infile) ;

>  }
>  else
>    infile = argv[1] ;

An array name cannot be assigned to. Reasons will be given below.

>
> getinput(infile) ;
>
>}
>------------------------------------------------------------------------
>
>Here is the message of the compiler : 
>
>
>
>ccom: Error: check.c, line 16: illegal lhs of assignment operator
>          infile = argv[1] ;
>      ---------------------^
>
>Isn't it legal to assign a pointer to a character to a character array ?

It is not legal to assign anything to an array name. An array name
is an rvalue, i.e. yields a pointer value when it is used in a pointer
context. It is not an object (lvalue). It cannot be assigned to because
there is no corresponding physical memory location that can be modified
in order to hold the POINTER value that is to be assigned to it.
The autoincrement and autodecrement operations do not work on array names
by the same token.

The issue of arrays and pointers was extensively discussed
in the comp.lang.c FAQ list, which, unfortunately, my site has no more.

>Somebody mentioned to me that RISC is not an ANSI compatible compiler. Is
>that so ?

Please see Chris Torek's posting referring to your previous article.
He says compilers giving the `no aggregate initialization allowed'
error message are descendants of an old, "creaky" compiler, and not ANSI.

Kind regards,
-- 
Mustafa KOCATURK  mustafa@seas.smu.edu   Electrical Engineering Department
Home:(214)706-5954  Work:(214)692-2541   SMU Box 753190, Dallas, TX 75275-3190
Newsgroups: comp.lang.c
From: pviswana@don.ece.uc.edu (Prashanth Viswanath)
Subject: Use of mmap(2), ptrace(2). Any examples out there?
Organization: Unversity of Cincinnati, ECE Dept
Date: Thu, 3 Sep 1992 14:06:13 GMT


Hello Netters:

	I would like some useful pointers on the use of mmap(2) and ptrace(2).
I know what they do..but I want real life examples, with code, if possible
to see how it is used..and where it is used.

I would appreciate any pointers to this topic. If you could directly
send it to my account, I will then summarize and post if sufficent interest
is generated.

Thanks and have a great one.
-- 
Prashanth Viswanath		    Elemental Telepathy
pviswana@uceng.uc.edu		    Exchange of Energy
pviswang@thor.ece.uc.edu 	    Reaction Making Contact 
Phone:  (H):(513) 651-1660          Mysteriously 
	(D):(513) 556-2499		--Rush [Chemistry, Signals #9]
	(W):(513) 556-4193/4770
Newsgroups: comp.lang.c
From: gny@doe.carleton.ca (George N. Yaremchuk)
Subject: C code for book 'Algorithms in C' by Sedgewick
Organization: Dept. of Electronics, Carleton University
Date: Thu, 3 Sep 1992 22:05:52 GMT

I was wondering if the any C source code was availiable (via ftp or email) for
the above mentioned book,  and if it is, is it public domain.  I didn't
see (no pun) any mention of this in the introduction in the book.

The full 'specs' of the book...

	Algorithms in C
	Robert Sedgewick
	Princeton University
	Addison-Wesley Publishing Co., 1990.
	ISBN 0-201-51425-7
	QA76.73.c15s43 1990

Thanks in advance for any info.
GNY

--
-------------------------------------------------------------------------------
   George N. Yaremchuk			   Email : gny@doe.carleton.ca
   Dept. of Electronics, Carleton Univ.,    Tel  : 613-788-2600 x8980
   Ottawa, Canada.	K1S 5B6
Xref: sparky comp.lang.c:12865 comp.std.c:2525
From: jfw@ksr.com (John F. Woods)
Newsgroups: comp.lang.c,comp.std.c
Subject: Re: strcpy implementation question
Date: 27 Aug 92 13:12:48 EDT
Distribution: comp

pausch@saaf.se (Paul Schlyter) writes:
>In article <1992Aug22.132132.13813@iecc.cambridge.ma.us> johnl@iecc.cambridge.ma.us (John R. Levine) writes:
>>But it doesn't say "(including the terminating null character and any other
>>garbage convenient for the compiler implementer)".  You have to stop at the
>>null byte.
>Even on a machine with word addressing, where each string is very likely to
>occupy an integral number of machine words?

Yes.  Life is tough when you're a compiler writer.
Newsgroups: comp.lang.c
From: yoram@frcs.Alt.ZA (Yoram Tal)
Subject: looking for C questionaire
Organization: M*N*E*T Pay TV
Date: Thu, 27 Aug 92 13:37:49 GMT
Summary: C
Keywords: C questionaire

Hi All !!!!

I would like to know if anyone out there has got or can get hold of a
typical 'C' questionaire used in evaluating technical expertise as far
as 'C' goes....
for instance, when going to a job interview (technical) and certain
questions are asked in order to gauge the experience level of the
candidate....


thanks in advance

P.S it would be nice if I could recieve a copy.... I have to prepare
one for the company I work for.


yoram 
(yoram@frcs.alt.za) 


 
yoram tal 
standard disclaimer applies            
yoram@frcs.alt.za   phone: (home) +27 11 783-2433  (Johannesburg,South Africa) 
-------------------------------------------------------------------------------
From: harrison@lclark.edu (Mark Harrison)
Newsgroups: comp.lang.c
Subject: Re: main()
Date: 2 Sep 92 16:20:15 GMT
Article-I.D.: lclark.1992Sep2.162015.11561
Organization: Lewis & Clark College, Portland OR

In article <cee1.715416182@Isis.MsState.Edu> cee1@ra.msstate.edu (Charles Evans) writes:
>Ok, I thought supposadly in ANSI C/C++ one was to declare main() as such:
>either:
>
>int main(void)
> or
>void main(void)
>
>BC++ books say int main(void) but what is the benefit of 'return 0' at the
>end.. seems like wasted space.
>
>Now in VERY new C++ books or VERY new C books, they usually have either
>
>int main()
>or void main()
>
>so what is wrong with 'main()' .. ANSI i suppose
>
>so what should i use
>
>void main(void) looks best (to me)?
>
>any htoughts?

In my programs, I use 'void main()' and never had any problems doing so. 
These are written with Turbo C/C++ 3.0, so I don't know about any others,
but it sounds like you are using BC, so there shouldn't be any difference.
If you just use 'main()' the compiler will assume that it is an int function.

-- 
=============================================================================
Mark Harrison           |  "We are the Priests, of the Temples of Syrinx
harrison@sun.lclark.edu |   Our great computers fill the hallowed halls."
              -- Me     |                                    -- Rush
From: karl@ima.isc.com (Karl Heuer)
Newsgroups: comp.lang.c
Subject: Re: deref NULL but no core dump on aix 3.1 ??
Date: 1 Sep 92 21:50:20 GMT
Article-I.D.: ima.1992Sep01.215020.6455
Organization: Interactive Systems, Cambridge, MA 02138-5302

In article <1yty#5a@rpi.edu> fitzgb@mml0.meche.rpi.edu (Brian Fitzgerald) writes:
>Why does this incorrect not dump core on an rs6000 running aix3.1 (but
>it does on a sun3).

If a program dumps core, something is wrong.  The converse is not true.

Trapping for null-pointer dereference is a convenient debugging aid, but
not all systems do it, alas.

Karl W. Z. Heuer (karl@ima.isc.com or uunet!ima!karl), The Walking Lint
Xref: sparky comp.lang.c:12875 comp.std.c:2527