HDTenEightyP/NetNews huggingface dataset:
From: msb@sq.sq.com (Mark Brader)
Subject: Re: string literal concatenation (was printf question)
Organization: SoftQuad Inc., Toronto, Canada
Date: Sun, 6 Sep 92 04:31:10 GMT

> > Just for the record, the ANSI C standard (X3.159-1989) does not divide
> > the task of compilation into `preprocessing' and `compilation' phases
> > as such.  Rather, it lists *eight* separate phases.  Phase 4 might be
> > called the `preprocessing' phase, but the standard does not do so.
> > Syntactic and semantic analysis, which might be called `compilation',
> > is phase 7.  String literal concatenation occurs in phase 6.
> 
> Although there may not exist a particular reference to a clause in the
> Standard which describes ``preprocessing'', there seems to be a clear
> delineation of high-level phases (oops), in which string literal
> concatenation would appear to fall under ``preprocessing''.

Actually the Standard *does* define "preprocessing"; it's in the first
paragraph of the Semantics of 3.8 (6.8 in ISO numbering).  It says:

#  The implementation can process and skip sections of source files
#  conditionally, include other source files, and replace macros.
#  These capabilities are called _preprocessing_, because conceptually
#  they occur before translation of the resulting translation unit.

In other words, "preprocessing" refers specifically to what happens in
phase 4.

It's a trivial matter anyway.  The important things to know are what
happens before what, and the fact that an ANSI C implementation is not
required to implement any combination of phases as a separate program.
-- 
Mark Brader		  "Should array indices start at 0 or 1?  My ecumenical
SoftQuad Inc., Toronto	   compromise of 0.5 was rejected without, I thought,
utzoo!sq!msb, msb@sq.com   proper consideration."  -- Stan Kelly-Bootle

This article is in the public domain.
Newsgroups: comp.lang.c
From: wright@epx.cis.umn.edu (Mark Wright)
Subject: Re: General data structure and algorithm C source
Organization: University of Minnesota
Date: Wed, 9 Sep 1992 14:14:35 GMT

In article <1992Sep9.135407.20797@pbhyg.PacBell.COM> jaorans@PacBell.COM (Jeff Oransky) writes:
>In article <1992Sep9.054305.26077@nuscc.nus.sg> ccewch@nuscc.nus.sg (Wong Chee Heng) writes:
>>May I know if there is any sample C source that implement data structure
>>like linked lists, B-tree, sorting, etc. that are published in quite a 
>>number of books on C. 
>>
>>Thanks for any info.
>>
>You might try "Advanced Turbo C programming" by Herbert Schildt.  I found
>and excellent introduction to linked lists and sorting there.
>
>------------------------------------------------------------------------------
>! Jeff Oransky             !   "Hope is the thing with feathers ......"      !
>! Pacific Bell             !         Woody Allen                             !
>------------------------------------------------------------------------------

I was suprised, but C - the Complete Reference does a suprisingly good job
of introducing linked-lists, trees, sorting, queues, stacks, sparse arrays,
and even has a decent section on some AI programming techniques.  Pretty much
covered what you'd get in an introductory Data Structures class without all
the (mostly useless) space-time analysis crap.  Plus, you get a good ANSI and
MicroSoft C reference (but no Borland specific info :-( ).  If you ignore the
pretty pathetic chapter on C++, it's an excellent book.  It's by Herbert
Schildt, and published by Osborne Mcgraw-Hill.

Mark Wright
wright@epx.cis.umn.edu
Newsgroups: comp.lang.c
From: bernie@metapro.DIALix.oz.au (Bernd Felsche)
Subject: Re: Why should POINTERS be so damn hard to understand ?
Organization: MetaPro Systems, Perth, Western Australia
Date: Sat, 5 Sep 92 05:47:03 GMT

In <1992Sep03.154038.27377@syscon.rn.com>
   carl@syscon.rn.com (Carl Kreider) writes:

>Certainly true, but I thought that "*p++ = *s++" derives directly from
>"mov (r0)+,(r1)+" for example.  In that sense C is high level assembler.

Isn't it in every sense? I thought that C was *supposed* to be a
portable macro assembler. [ 1/2 ;-) ]
-- 
+-----+ Bernd Felsche                     _--_|\  #include <std/disclaimer.h>
| | | | MetaPro Systems Pty Ltd          /      \ bernie@metapro.DIALix.oz.au
| | | | 328 Albany Highway,              X_.--._/         Fax: +61 9 472 3337
|m|p|s| Victoria Park, Western Australia 6100  v        Phone: +61 9 362 9355
Newsgroups: comp.lang.c
From: carmo@azu.informatik.uni-stuttgart.de (Paulo Roberto Schmitt do Carmo)
Subject: HighMem-Help-Brazil
Organization: Inst. de Inf. UFRGS
Date: Mon, 14 Sep 1992 15:48:52 GMT

I've got a 386 with DOS 5.0, 4 Mbytes RAM and TurboC Compiler.
My program access only the 640Kb low memory. How can I access
the high memory? Can someone please help a brazilian who can 
not find any help in his country?

	Thanks in advance,

				Paulo.
=============================================================================
Paulo Roberto Schmitt do Carmo				  carmo@inf.ufrgs.br
Instituto de Informatica -- Universidade Federal do Rio Grande do Sul BRAZIL 
=============================================================================

Newsgroups: comp.lang.c
From: gordon@osiris.cso.uiuc.edu (John Gordon)
Subject: Re: Command Line Arguments
Organization: University of Illinois at Urbana
Date: Wed, 9 Sep 1992 00:25:17 GMT

bx314@cleveland.Freenet.Edu (Joseph J. Gebis) writes:


>	I would like to know how to pass command line arguments in DOS
>to a separate function...  I would greatly appreciate if someone
>would write an example of a program that passes command line arguments
>to a separate function that then prints them on screen.

	Was there a specific language you had in mind for this?
From: karl@ima.isc.com (Karl Heuer)
Newsgroups: comp.lang.c
Subject: Re: getting characters
Date: 11 Sep 92 22:05:12 GMT
Article-I.D.: ima.1992Sep11.220512.4332
Organization: Interactive Systems, Cambridge, MA 02138-5302

In article <BuDt1C.38v@usenet.ucs.indiana.edu> foxd@silver.ucs.indiana.edu (daniel fox) writes:
>I would like to know what function call would enable me to get characters one
>at a time from the keyboard [without having to hit RETURN].

This is mentioned in the FAQ, but I'll answer it anyway since the FAQ doesn't
give a complete discussion of the issue.

The short answer: there is no such function in the standard C library%.

A more useful answer depends on what operating system you're running.  On some
types of personal computers, there may be a kbhit() and/or getch() function
that does what you want.  On modern Unix and POSIX systems, you'll probably
want to set the terminal modes with ioctl() to turn off the ICANON flag (and
optionally turn off ECHO).  On some Unix variants you may have to turn on the
CBREAK flag instead.  If you have the curses package and don't mind using it
for this project, you can use its getch() function, which does this for you.

For more details, check (a) your manual, (b) your local expert, (c) an
appropriate system-specific group (such as comp.unix.programmer).

Karl W. Z. Heuer (karl@ima.isc.com or uunet!ima!karl), The Walking Lint
________
% It's conceivable that some future version of the standard will have such a
  function, but first the behavior needs to be specified more precisely.
  I've got a good first approximation to such a (portable) function in my
  personal library.
From: robert@isgtec.com (Robert Osborne)
Newsgroups: comp.lang.c
Subject: Re: Only C gurus allowed?!?!
Date: 12 Sep 92 12:56:18 GMT

eletanjm@nuscc.nus.sg (TAN JIN MENG) writes:
> Please stop mailing!!! Too much already... I don't have the time.
> 
> Anyway, First I wasn't wrong. My examples were correct, just that
> my explanation was murky (my vocab is excellent but my expression
> sometimes leaves much to be desired). I later posted a further
> explanation anyway. Second, my main complaint is the uncivility of some
> people not really the issue of who is allowed to post. I guess I got
> carried away when I wrote the original article.

I still don't understand why you keep defending a posting that you
admit was 'murky'.  If you would quit defending your position you'd
probably stop getting mail.

> i do not normally read frivolous groups. However, it seems that in this
> group more than others, I have to watch what I say - this is implied
> censorship in my view (maybe not in yours).

To summarize:
When you post it's free speech.
When others say your post is idiotic so stop posting that's censorship.
When you post telling them to stop posting that's free speech again.

No wonder you're getting tons of mail.

Rob.
--
Robert A. Osborne   ...!uunet.ca!isgtec!robert or robert@isgtec.com
Newsgroups: comp.lang.c
From: ara@zurich.ai.mit.edu (Allan Adler)
Subject: where the program spends its time
Organization: M.I.T. Artificial Intelligence Lab.
Distribution: comp
Date: Thu, 10 Sep 1992 06:04:45 GMT



What facilities are there for determining what are the most time consuming
parts of a C program, which commands are called most often, how long
a particular routine takes, etc?

I'm reading Knuth's article on goto statements and he says that in the
future, which I assume is now, compilers will be designed to include
such features. So what about C, and I do mean ANSI C?

Allan Adler
ara@altdorf.ai.mit.edu
Newsgroups: comp.lang.c
From: lezz@merlin.dev.cdx.mot.com (Lezz Giles)
Subject: Re: SEX SEX SEX
Reply-To: lezz@merlin.dev.cdx.mot.com (Lezz Giles)
Organization: Motorola Codex, Canton, MA
Distribution: usa
Date: Thu, 10 Sep 1992 14:05:38 GMT

In article <1992Sep10.035551.28773@oracle.us.oracle.com>, wkaufman@us.oracle.com (William Kaufman) writes:
|>In article <1992Sep7.144956.8667@merlin.dev.cdx.mot.com> lezz@merlin.dev.cdx.mot.com (Lezz Giles) writes:
|>] 
|>] I used to think that SEX was something to do with byte ordering in 16- or 32-
|>] (or more) bit values (or was it nybble ordering?)?  Does it mean something
|>] else as well?  Have I been spending too much time in front of my computer :-)
|>
|>    No, you've just been slaving in front of the wrong machine.  SEX is
|>the 16-bit-to-32-bit Sign EXtension command.  Why, what did you think it
|>meant?

I thought it could be used to distinguish between little-endian and big-endian
architectures, as in "What's the sex of an 8086 - is it big-endian or little-
endian?".  This could be a faulty memory though... after I'd written the
previous article I remembered the Sign-EXtend.

Of course, SEX also rears its ugly head in connectors - I always thought that
the imageary in "male plugs" and "female sockets" was rather too graphic (not
forgetting gender-benders :-) but this is nothing to do with C...

Lezz "Mr Irrelevant" Giles
From: pynq@quads.uchicago.edu (George Jetson)
Newsgroups: comp.lang.c
Subject: Re: Problems with QSORT and function prototypes
Date: 15 Sep 92 14:34:58 GMT
Reply-To: pynq@midway.uchicago.edu
Organization: D. J. Dougherty & Associates

In article <1992Sep15.123225.22760@blaze.cs.jhu.edu> wilson@rhombus.cs.jhu.edu (Dwight Wilson) writes:

>
>qsort() is declared as:
>
>void qsort(void *base, size_t nmemb, size_t size,
>           int (*compar)(const void *, const void *));
>
>Your problem is being caused by the fourth argument, the comparison
>function.  qsort's declaration means that the comparison function
>should take two (void *) parameters and return an int.
>
>Your functions expect two struct thing pointers or two int pointers.
>You must rewrite them to take (void *) arguments (and cast them
>internally).

In fact, to get it past Borland C, I had to declare them as "const void *" -
void * alone was not enough.

Interestingly enough, the following hack worked as well:
Declare:

	int (*fp)() = int_cmp;

Then use fp, not int_cmp, in the call to qsort().

I'm not sure which hack is less unattractive, but the fact that Borland
treats this as an error, not merely a warning, seems a bit excessive to me.

************************************************************************
A note to new readers:  the weasely :-) symbol is frowned upon in this
group.  Any questions, see Phil Gustafson who will gladly rearrange your
diodes for you.
			- From the AFU FAQ -

	- pynq@quads.uchicago.edu, who is still costing the net
	  hundreds, if not thousands, of dollars, every time he posts -
************************************************************************
Newsgroups: comp.lang.c
From: mitch@nosc.mil (Ray Mitchell)
Subject: File Handling
Organization: Naval Ocean Systems Center, San Diego, CA
Date: Wed, 9 Sep 1992 17:37:17 GMT


This problem must have an easy solution.  Assume the typical case where a
binary file consists of several records (structures).  I wish to write a
program in which the user specifies which record is to be modified.  My
initial approach was to simply fseek into the file the appropriate amount
then overwrite the record at that position.  That worked fine.

The problem comes when I attempt to do some error checking.  If the user
specifies a record which is not in the file and fseek beyond the end of
file is generated.  I had hoped that such an fseek would return an error
but apparently fseek blindly sets the file position indicator in the
FILE structure without testing if the seek is possible.  My next approach
was to ignore the return value of fseek and instead call ftell immediately
after fseek and compare the return from ftell with the offset I had
specified in fseek.  No luck.  Ftell apparently just blindly reads the
file position indicator also and returns the result.

My final attempt was to simply go ahead and try to write to the file using
fwrite, assuming that if a previous fseek were out of range the fwite would
return failure.  Suprisingly, this didn't work either.  fwrite returned a
value indicating it worked.  I don't know what fwrite actually did, if
anything.  Any suggestions are appreciated.

Thanks,  Ray Mitchell
From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius)
Newsgroups: comp.lang.c
Subject: Re: Help!!! Please Read this message!?!?!?!?!...
Date: 11 Sep 92 20:45:18 GMT
Organization: University of Helsinki

wirzeniu@klaava.Helsinki.FI (Lars Wirzenius) writes:
>All arguments to functions with no prototype, or a
>prototype that does not specify any arguments, or arguments that are
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>part of the variable part of a variable arguments list, undergo the so
>called ``default promotions''

I'm into corrections tonight: The underlined words are inaccurate, they
indicate a function like this:

	int foo(void);

when I meant to indicate something like this:

	int foo();

If I change that phrase into ``or a prototype that specifies an
unknown argument list'', it might convey the intended meaning better.

Thanks to the same person who pointed out my previous blunder.

--
Lars.Wirzenius@helsinki.fi
Newsgroups: comp.lang.c,comp.unix.programmer
Newsgroups: comp.lang.c
Subject: max. size of functional unit
Date: Tue, 08 Sep 1992 21:05:00 -0200

Are there any recommendations for the maximum size of a functional unit before
this unit should be split in separate functions?
 
I know that some code is harder to understand than other code, but the size
could be measured in other units then lines of code, couldn't it?
 
The point should be human's ability to catch the behaviour of the functional
unit just by browsing thru the code one time; similar to this rule that someone
can get the number of approx. 5 to 7 items without actually counting them.
 
Chow-Chow
 
Volker

 * Origin: Aber da unten war's warm! Es war schoen! (2:244/55)
From: mikey@ontek.com (euphausia superba)
Newsgroups: comp.lang.c
Subject: Re: I disagree with lint(1)
Keywords: lint, classic C
Date: 8 Sep 92 21:12:09 GMT
Organization: Ontek Corporation -- Laguna Hills, California

In comp.lang.c, hansm@cs.kun.nl (Hans Mulder) writes:
| Hello C gurus,
| 
| I just asked lint(1)'s opinion on this piece of code:
| 
| typedef struct foo *bar;
| 
| fun(b)
| bar b;
| {
|     b=b;
| }
| 
| struct foo
| {
|     int i;
| }   the_struct;
| 
| main()
| {
|     fun(&the_struct);
|     return 0;
| }
| 
| Lint(1) says:
| 
| fun, arg. 1 used inconsistently	foo.c(5)  ::  foo.c(16)
| 
| I disagree.  The first argument to fun is a pointer to struct foo on both
| lines.  In my book, that's the same.
| 
| What do you all think?

I think lint is complaining not about the typedef, but because
at the point where fun() is defined, "struct foo", and hence "foo *" 
are incomplete types.  This should shut lint up:

  typedef struct foo *bar;

  struct foo
  {
      int i;
  }   the_struct;

  fun(b)
  bar b;
  {
      b=b;
  }

  main()
  {
      fun(&the_struct);
      return 0;
  }

      the krill
From: srt@duke.cs.duke.edu (Stephen R. Tate)
Newsgroups: comp.lang.c
Subject: Re: Why should POINTERS be so damn hard to understand ?
Date: 7 Sep 92 18:53:48 GMT
Organization: Duke University Computer Science Dept.; Durham, N.C.

In article <14367@goanna.cs.rmit.oz.au> ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes:
>How often do I have to say it?  "move (r0)+,(r1)+" is a PDP-11 instruction.
>The PDP-11 was _NOT_ the first machine C ran on, nor the machine C was
>designed for.  _That_ machine DID NOT HAVE SUCH INSTRUCTIONS.

Well, you'd have to say it many, many times, because what you say
simply isn't true...  To quote from the preface of K&R (1st edition):

    "C was originally designed for and implemented on the UNIX
     operating system on the DEC PDP-11, by Dennis Ritchie."

Since I believe it is without dispute that the "R" of "K&R" (Ritchie)
designed C, are you saying they lied in their book?

You didn't *really* think that it was pure coincidence that C syntax
has so much in common with PDP-11 assembler and addressing modes, did
you?  Maybe all the planets were aligned just right and caused such
a bizarre coincidence to happen?  Maybe you don't know PDP-11 assembler,
so aren't aware of just how similar they are?

Please get your facts straight before you come off sounding so damned
condescending....


-- 
Steve Tate srt@cs.duke.edu | The reason why mathematics enjoys special esteem,
Dept. of Computer Science  | above all other sciences, is that its laws are
Duke University     | absolutely certain and indisputable, while those of all
Durham, NC  27706   | other sciences are to some extent debatable. (Einstein)
Newsgroups: comp.lang.c
From: behrenss@Informatik.TU-Muenchen.DE (Soenke Behrens)
Subject: Re: Print #define
Organization: Technische Universitaet Muenchen, Germany
Date: Wed, 9 Sep 1992 15:53:44 GMT

lisa@us-es.sel.de (Lisa Goulet) writes:

>In K&R C, is there a way to print a preprocessor variable?
>e.g.  With the following define 
>        #define Architecture hp300
>      to be able to print the "hp300" part.

Not that I could think of a way to do that. You would need to get
the macro into a character string, and CPP doesn't expand macros inside
of character strings.

Not that I could think of any necessity to do such a thing, either :)

Soenke
-- 
===========================================================================
More than silver, more than gold, I need   !    behrenss@informatik.
electricity. I need it for my dreams.      !    tu-muenchen.de
(RACTER)                                   !  FIDO: 2:246/13 Soenke Behrens
Newsgroups: comp.lang.c,comp.std.c
From: dat@thinkage.on.ca (David Adrien Tanguay)
Subject: Re: strcpy implementation question
Organization: Thinkage, Ltd.
Date: Tue, 8 Sep 1992 17:08:16 GMT

torek@horse.ee.lbl.gov (Chris Torek) writes:
>This means that you can use functions like `puts' and `strlen' without
>declaring them and without including the appropriate header, but you

Oops! strlen returns size_t...
-- 
David Tanguay       dat@Thinkage.on.ca  dat@Thinkage.com  uunet!thinkage!dat
Thinkage, Ltd.           Kitchener, Ontario, Canada          [43.40N 80.47W]
From: karl@ima.isc.com (Karl Heuer)
Newsgroups: comp.lang.c
Subject: Re: dynamic multidimensions qtn ?
Keywords: pointers 2 dimensions
Date: 11 Sep 92 22:16:00 GMT
Article-I.D.: ima.1992Sep11.221600.4605
Organization: Interactive Systems, Cambridge, MA 02138-5302

In article <simon.716185168@giaeb> simon@giaec.cc.monash.edu.au (simon shields) writes:
>Is it possible to have dynamic multidimensions in c.

I have sent a copy of the FAQ, with attention to item 2.10.

Karl W. Z. Heuer (karl@ima.isc.com or uunet!ima!karl), The Walking Lint
From: cc100aa@xray.gatech.edu (Ray Spalding)
Newsgroups: comp.lang.c
Subject: Re: How to call procedure with a variable?!
Keywords: C VARIABLE PROCEDURE
Date: 11 Sep 92 16:15:10 GMT
Organization: Georgia Institute of Technology

In article <1992Sep11.145441.5720@cbfsb.cb.att.com> edb1@cbnewsf.cb.att.com (edward.benyukhis) writes:
>In article <67971@hydra.gatech.EDU> cc100aa@xray.gatech.edu (Ray Spalding) writes:
>>	t = gotoproc(1,2,3);
>_________________________________
>This is somewhat erroneous.  The way you invoke a function is:
>	t = (*gotoproc)(1,2,3);

Harbison & Steel (2nd ed. p. 273) say "In the function invocation
f(...), the expression f may have the type "pointer to function...,"
in which case an automatic dereference of the function pointer is
made in order to perform the call."

I believe this is OK per ANSI as well -- anyone know for sure?
-- 
Ray Spalding, Office of Information Technology
Georgia Institute of Technology, Atlanta Georgia, 30332-0715
Internet: ray.spalding@oit.gatech.edu (NeXT Mail accepted)
From: g-yao@cs.yorku.ca (Ling Yao)
Newsgroups: comp.lang.c
Subject: Help to solve problem with "gets()"
Date: 10 Sep 92 19:02:04 GMT
Article-I.D.: yetti.1429
Distribution: world
Organization: York University, Dept. of Computer Science

Hi, Dear friends:

   As a "C" novice, I would like to ask some advice about how to use
   gets().

The following is my programm:

*************************************************************************
#include <stdio.h>

static char *message[]={"Translation:",
			    "0. X      1. Y    2. Z",
                        "Exit:",
			    "x or X",
			 NULL
                        };
main()
{
    float tmp;
    int i=0;
    char *a;

/* print input message */
    while(*message[i]!=NULL)
    {
	printf("%s\n",message[i]);
	i++;
    }

   L1: gets(a);
    printf("gets=%s\n",a);

    switch(*a) {
    case '0': printf("translate in x ");
            return(1); 

    case '1': printf("translate in y ");
            return(1);

    case '2': printf("translate in z");
            return(1);

    case 'x':
    case 'X':
	return(0);


    default:
	 goto L1;
    }
}
**************************************************************************

When I run it , I get following result:

----------------------------------
Translation:
0. X      1. Y    2. Z
Exit:
x or X
Segmentation fault (core dumped) 
_________________________________

When I use lint, it showed:

____________________________________
gets() returns value always ignore.
------------------------------------

Some friends who can kindly give me some help ,
I would it appreciate very much.

Please answer this by email , if it is convience to you.

Thanks in advance.


+-------------------------------------------------------------+
| Ling YAO                        "I die when it's time for   |
| Department of Computer Science   me to die. So let me live  |
| York University                  my life the way I want to."|
| North York, Ont. Canada M3J 1P3         -----Jimi Hendrix   | 
| e-mail: g-yao@cs.yorku.ca                                   |
| Office phone:(416)736-2100       home phone:(416)650-1480   |
|        Ext.20242 or 20275        Fax:       (416)650-1480   |
+-------------------------------------------------------------+
-- 

+-------------------------------------------------------------+
| Ling YAO                        "I die when it's time for   |
| Department of Computer Science   me to die. So let me live  |
Newsgroups: comp.lang.c