HDTenEightyP/NetNews huggingface dataset:
From: throopw@sheol.UUCP (Wayne Throop)
Newsgroups: comp.lang.c
Subject: Re: C language criticism
Summary: some confusion yes, but why so *much*?
Date: 17 Aug 92 02:16:06 GMT

> From: bevan@cs.man.ac.uk (Stephen J Bevan)
> Message-ID:
>>   I submit that nothing could be simpler or more intuitive.
>>         [.. than an example of taking an address of an array
>>                to assign to a pointer-to-array variable ..]
> Well besides the fact that it is wrong (as has been pointed out
> elsewhere), I think you'd have too have your tongue in your cheek when
> describing it as "simple" and "intuitive".  

Well.... yes and no.  What tripped me up in the example was 
the obfuscation of the formal type rewriting semantics, motivated
in turn by the lack of formal argument prototypes in Aboriginal C.
I'd still argue that the example done like so in ANSI C:

       f(){
           extern char *a[];
           char *(*ap)[];
           ap = &a;
       }

is quite simple and intuitive.

> I'm sure some people revel
> in writing/decoding declarations like the above, but I'd hope that the
> majority of people would use some carefully chosen typedefs instead.

Granted that the precedence of [] and * confuse people, but other
than that, what is more complicated about

             char *a[];
than
             a: array of pointer char;

Or put it this way.  I don't see why it is any better to say

         typedef char * char_pointer;
         char_pointer a[];

any more than it'd be better to say

         typedef char * char_pointer;
         typedef struct namelist_node *namelist_node_pointer;
         struct namelist_node {
             namelist_node_pointer name;
             char_pointer name;
         };

Of course, I may be misinterpreting Stephen's recommendation.
--
Wayne Throop  ...!mcnc!dg-rtp!sheol!throopw
From: desmarai@ERE.UMontreal.CA (Desmarais Normand)
Newsgroups: comp.lang.c
Subject: Linker Error: Segment _TEXT exceeds 64K
Summary: What does it mean?
Keywords: BC++ 2.0, Linker Error, _TEXT
Date: 21 Aug 92 01:05:11 GMT
Organization: Universite de Montreal




"Linker Error:  Segment _TEXT exceeds 64K"


Could someone explain to me what it does mean?  It is not doccumented in
my Borland C++ 2.0 books.  How could I correct this problem?  I tried to
break my big source file in five parts, but it didn't change anything.
BTW my programm is written in C, not in C++.

Thank You!
Norm.
From: scotth@felix.filenet.com (Scott Hopson)
Newsgroups: comp.lang.c
Subject: Re: Ctrl-Alt-Delete trapping.
Date: 21 Aug 92 06:21:14 GMT
Reply-To: scotth@fritz.filenet.com (Scott Hopson)
Organization: FileNet Corp., Costa Mesa, CA

Here is some code to trap the Ctrl-Alt-Del keypress on a PC running
DOS.

------------------------------CUT HERE----------------------------------
#include <dos.h> 
#include <stdio.h> 
 
#define KBD_PORT 0x60	/* keyboard port (scan codes placed here) */
#define KBD_STAT 0x61   /* keyboard status port */
#define DEL	 0x53	/* delete key scan code */
#define CTRL_ALT 0x0c	/* Control and Alt keys pressed */
#define PIC	 0x20	/* Programmable Interrupt Controller Port */
#define EOI	 0x20   /* End Of Interrupt */

void interrupt (*oldint9)(); 
 
void interrupt int9(void) 
{ 
unsigned char far *kbdata = MK_FP(0x40,0x17); /* keyboard status data */ 
unsigned char byte1,byte2;		      /* segment is at 0040:0017 */
 
	if((*kbdata & CTRL_ALT) && (inportb(KBD_PORT) == DEL)) 
	{ 
		byte1=byte2=inportb(KBD_STAT);	 
		byte1 |= 0x80; 
		outportb(KBD_STAT,byte1); 
		outportb(KBD_STAT,byte2); 
		outportb(PIC,EOI); 
	} 
	else 
		oldint9(); 
} 
 
 
void main() 
{ 

	oldint9 = getvect(0x09); 
	setvect(0x09,int9); 
 
    /** insert your code or go TSR **/
 
	setvect(0x09,oldint9);   /* restore old handler before exit */
	exit(0);
}

------------------------------CUT HERE----------------------------------


Note: if you want to run this as a TSR then you need to figure how much
space you want to reserve and call keep(); Which will reserve the code 
in memory and terminate.

-- 
Scott Hopson   (scotth@filenet.com)
Newsgroups: comp.lang.c
From: bcschu@skws02.monsanto.com (Brett Schultz)
Subject: Re: Optimizing code for tests
Organization: Monsanto Company
Date: Wed, 12 Aug 1992 20:03:03 GMT

I am writing a computationally expensive program now.  In order to make it
run faster, I compiled each object using cc with the -j option and then the
entire thing with the -O3 option.  This didn't run any faster than when I had
used the -g option.  What can the compiler do to help the program run faster?

My program is expensive also due to comparisons.  I think that is what Jeffrey
L Bromberg was talking about.  I think what he was asking is if the compiler 
optimizes comparisons in your algorithm (right??).  I don't know if he tried
to use the compiler optimization options.  Try it and let me know what you get.

Did I use the optimatization options correctly with cc, and if so, why didn't
it make my program faster.

Any input will be helpful

Thanks in advance.


Brett

bcschu@skws02.monsanto.com
From: jlg@cochiti.lanl.gov (Jim Giles)
Newsgroups: comp.lang.c
Subject: Re: Giles' Manual Mania (Was - Re: About the 'F' in RTFM)
Date: 13 Aug 92 23:26:56 GMT
Organization: Los Alamos National Laboratory

In article <1992Aug13.175711.27749@mksol.dseg.ti.com>, mccall@mksol.dseg.ti.com (fred j mccall 575-3539) writes:
|> [...]
|> >Second, what it's supposed to do often doesn't match what it does.  
|> 
|> Then you REALLY have a problem.  If you have a sine routine and it
|> computes tangent instead, I'd say that more than the documentation is
|> broken.  I've found that a lot of the time when people come to me and
|> say "This doesn't do what the documentation says it does", the real
|> problem is that they've misread the documentation.

Six of one ....  Whether the document is misunderstood or whether it's
wrong, it's badly written - and that's the major problem.  If a document
is persistently misread, then it's just as wrong as if it contained false
information.

In any case, this is my final word on the subject of manual quality:

   Given a set of documents on one hand and a friendly guru (who is willing 
   to answer all questions with no insults and without saying RTFM) on the
   other hand, if the average user *chooses* to read the document, then the 
   documentation is well written.  I will adopt that as my definition of 
   "well written".

I've used software products where the bulk of the users *preferred* to
obtain and read the documents rather than asking the consultants.  I know
this is a possible way to write software/documents.  Admittedly, most 
commercial and/or public domain software is not documented in this way.
UNIX documents are worse than most - they remind me a lot of OS/360
manuals in the way you have to dig through them to get the information 
you need.  The OS/360 stuff was like that through over-organization, and
the UNIX stuff through under-organization.  And BOTH describe user 
environments which are filled with niggly little arcane "gotchas"
that would be hard for anyone to document.

-- 
J. Giles
Xref: sparky comp.lang.c:12551 comp.os.vms:13867
From: npm@dale.cts.com (Nancy Milligan)
Newsgroups: comp.lang.c,comp.os.vms
Subject: ANSI C Compiler for VMS
Date: 19 Aug 92 18:00:29 GMT
Followup-To: comp.lang.c
Organization: Titan Linkabit Corp., San Diego

Gentlefolk,

I would like to solicit your opinions on ANSI C compilers for DEC's VMS
operating system.

We're looking to buy one and this is what I've heard or know so far:

- VAX C is currently *not* ANSI,

- GNU C on VMS is buggy,

- TauMetric offers ANSI C in its C++ compiler.

Is TauMetric the one to choose?  Have I missed anybody?  
Thanks.  I'll summarize and post the results.

Please send e-mail to glippert@dale.cts.com (I'm posting this via someone
else).  
Newsgroups: comp.lang.c
From: brannon@stun4r.cs.caltech.edu (Terrence M. Brannon)
Subject: why does #define Ctrl(c) c&037 work ?
Organization: Caltech Yoga Qi Gong Tai Chi
Distribution: worrrld
Date: Thu, 13 Aug 1992 00:42:22 GMT


I am hacking thru the source code for GNU Emacs and I came across
this:

#define Ctl(c) ((c)&037)

and I am wondering why a bitwise-AND of the ASCII value for a chacter
and octal 037 (binary 00111111) would generate the control version of
a printable character.

--

Terrence Brannon       (brannon@jove.cs.caltech.edu)  
medical biology via acupuncture and particle physics



Newsgroups: comp.lang.c
From: atbowler@thinkage.on.ca (Alan Bowler)
Subject: Re: Sort help needed
Organization: /etc/organization
Date: Mon, 17 Aug 1992 16:54:43 GMT

In article <3225@dozo.and.nl> jos@and.nl (Jos Horsmeier) writes:
>In article <2125@ontek.com> mikey@ontek.com (euphausia superba) writes:
>|In comp.lang.c, jos@and.nl (Jos Horsmeier) writes:
>|| 
>|| Have a look at the qsort function, it's in your lib somewhere. If you can't
>|| use that function for some reason (I don't see why,) may I suggest an
>|| alternative algorithm: heap sort. It's a bit slower than quick sort,
>|| but it's a very stable algorithm. i.e. quicksort might degenerate to
>|| O(n^2) behavior in the worst case, but heap sort is stable at O(n*log(n)).

Just a reminder.  There is no requirement that the the library "qsort"
routine be implemented with one of the many varients on Hoare's "quick
sort" algorithm.  The name may be suggestive, but implementors may very
well use some other algorithm such as heapsort or Shell sort which have
better worse case behaviour.
    Try the library "qsort" first.  If it works fine, use it.  If it
degenerates into an O(N**2) and that is too slow for your application
   1) Complain to your vendor with the real life example.

   2) Until he replies with a better "qsort" function, write your
      own replacement using some other algorithm. Both Shell
      and heap sorts are very easy to write.
Newsgroups: comp.lang.c
Subject: I need source for strptime function
From: marko@jupiter.cse.utoledo.edu (Marko A. Jovanovic)
Date: 21 Aug 92 14:44:58 EST

I would appreciate if anyone can send me the source code for the strptime
function.  The machine I'm working on right now has an old release of Unix
and strptime, strftime, and some other functions are missing.


	Marko A. Jovanovic

	System Manager
	Computer Science and Engineering
	University of Toledo

	(marko@jupiter.cse.utoledo.edu)
From: u9035710@cs.uow.edu.au (Scott Anthony Barnett)
Newsgroups: comp.lang.c
Subject: Memory woes - with Graphics
Keywords: Borland C
Date: 13 Aug 92 03:27:02 GMT
Organization: Dept of Computer Science, Wollongong University, Australia

Using Borland C ++ V3.0, I am finding it impossible to access more
than one 64K data segment.

Using graphics commands, the HUGE memory model, and 7 different files.

It still seems that all 7 files are using the one 64K segment.  

How can I force each files data area into a different segment ????


-- 
=====================================================================
= Scott Barnett =========== Email : u9035710@wraith.cs.uow.edu.au   =
= 3rd Year Comp. Engineer. == University of Wollongong, Australia   =
===(Such creative flair only to be limited by a 4 line .sig limit)===
Xref: sparky comp.lang.c:12447 gnu.gcc.help:1920
Newsgroups: comp.lang.c,gnu.gcc,gnu.gcc.help
From: wkaufman@us.oracle.com (William Kaufman)
Subject: Re: gcc-cpp chokes: bug or feature?
Organization: Oracle Corporation, Redwood Shores CA
Date: Sat, 15 Aug 1992 05:20:21 GMT
X-Disclaimer: This message was written by an unauthenticated user
              at Oracle Corporation.  The opinions expressed are those
              of the user and not necessarily those of Oracle.

In article <BszKpr.GBu@cs.columbia.edu> leland@cs.columbia.edu (Leland Woodbury) writes:
] #if 0
[... uses preprocessor for comments, but gcc-cpp checks contents...]
] 
] I haven't looked at the source code, but does this make any sense to
] anyone?  Is there something in ANSI C that requires such behavior?
] Obviously, gcc-cpp is parsing -- in a line-oriented fashion -- the text
] between the #if 0 and the #endif, but what's it looking for (besides
] #else or #endif)?  Why is it parsing what should be getting ifdef'd
] out?
] 
] Leland Woodbury
] #endif

#if 0

    Well, it's got to check for an #endif, right?  The #endif here
doesn't count, but it does have to look at it,...  This one: "

#endif

" doesn't count either, because it's contained in quotes: it's a
character literal, not a preprocessor directive.  Neither is: /*

#endif

*/, because it's in comments.  If it's very careful, it may even have to
parse #include files inside a "comment" block, to check for the #endif
in there.  Dangerous practice, dangling #if/#endifs between files, but
it has been known to be done.

    Does that answer your question?

.article:45: unterminated #if conditional

                                           -- Bill K.

Bill Kaufman,          | "Hush my darling / Be still my darling /
Corporate Lackey       |  The lion's on the phone,..."
wkaufman@us.oracle.com |              -- "The Guitar", They Might Be Giants
From: dave@cs.arizona.edu (Dave Schaumann)
Newsgroups: comp.lang.c
Subject: Re: Would this be the place to...
Date: 17 Aug 92 05:22:36 GMT
Reply-To: dave@cs.arizona.edu (Dave Schaumann)
Organization: University of Arizona

In article <1992Aug8.052246.14904@mailer.cc.fsu.edu>, c3460344@fsu1 (C3460344) writes:
>If I have a piece of code that I am having trouble finding a problem in, 
>would I post it here?  It is about 50 or so lines...

It's been done before.  I generally read news on a 45-or-so line screen;
When I see "what's wrong with this" followed by more than half a screen
of code, I almost always immediatley 'n' right by it.

>I am getting garbage in the trans_type element of this structure when I 
>print it to screen:
>
>typedef struct {
>       char date[9];
>       char cknum[4];
>       char comment[21];
>       char trans_type[4];
>       float amount;
>} entry;

>So, I am assuming that I am lacking some variable initialization.

Could also be field overflow; if you try to put more than 21 characters
in your `comment' field, most likely it'll overflow into `trans_type'.

>How would I go about initializing an 
>array full of these structures

assuming you mean constant initialization:

entry Register[MAX] = {
  { "8/16/92", "100", "loan payment", "w",  200.00 },
  { "8/17/92", "101", "tuition"     , "w", 1234.56 },
  { "8/21/92", ""   , "pay day!"    , "d",   63.27 },
  { "", "", "", "", 0.0 }
} ;

-- 
Dave Schaumann			dave@cs.arizona.edu
From: ptran@envmsa.eas.asu.edu (Phi-Long Tran)
Newsgroups: comp.lang.c
Subject: Re: Request for Structure Help !
Date: 21 Aug 92 08:03:00 GMT
Organization: Arizona State University, Tempe, AZ
News-Software: VAX/VMS VNEWS 1.4-b1

In article <20AUG92.20525774@vax.clarku.edu>, 
ekender@vax.clarku.edu writes...

>   typedef struct {
>         int count;
>         char string[0];
>         } string_t;

     There was a long discussion on this newsgroup a while back on the
above usage to store a variable-length data object.  For example, suppose
the string is "Phi-Long Tran".  To allocate a string_t object for this
string, you would call malloc in the following manner:

     string_t *name = malloc( sizeof( *name ) + (14 * sizeof( char )) );

     Then you would copy the string and assign the number of characters to
the count field:

     name->count = 14;
     strcpy( name->string, "Phi-Long Tran" );

When you no longer need "name", you only need to free it once with "free(
name )".  Many prefer this usage to the following:

     typedef struct (
	  int count;
	  char *string;
	  } string_t;

Using the above declaration, you would need to call malloc once for a
pointer to string_t, and then another time for the string field.
Correspondingly, you would need to free the object twice:  the string
pointer first, then the pointer to the object.

     You may want to check the FAQ for this newsgroup.

---
Phi-Long Tran
ptran@asuvax.eas.asu.edu
Arizona State University
Newsgroups: comp.lang.c
From: ganesh@cs.albany.edu (Ganesh Murugesan)
Subject: Re: problems with atof() 
Originator: ganesh@karp.albany.edu
Organization: Computer Science Department, SUNY at Albany, Albany, NY 12222
Date: Thu, 20 Aug 1992 17:16:37 GMT

In article <1992Aug20.125252.3451@dxcern.cern.ch> nilo@atdigarfield.cern.ch (Operator) writes:

>   Hello!
>
>   I have a problem withe the atof() function, you know string to double 
>  conversion. 
>   I can not figure out where the error is, so any help will be really really appreciated.
>


Include  <math.h> and it will work. Else C compiler takes atof
return value as int by default and hence returns a junk value.

Also may be better to link the math libraary lm while compiling.
It works if U do these.

Ganesh
From: 754clifton@gw.wmich.edu
Newsgroups: comp.lang.c
Subject: Re: Help: read() question.
Date: 22 Aug 92 15:32:39 EST
Organization: Western Michigan University

In article <25663@dog.ee.lbl.gov>, torek@horse.ee.lbl.gov (Chris Torek) writes:
> In article <1992Aug21.154401.5050@gw.wmich.edu> 754clifton@gw.wmich.edu writes:
>>Assuming I have a file I have found the exact size (len) of using lseek or
>>some other method. Assume also that I have a valid file descriptor ...
> 
> What is a `file descriptor', and where is `lseek' in the C standard?
> 
>>	nread = read(fd, buf, len); 
> 
> You have not shown us your `read' function.  Can we please keep UNIX
> and MS-DOS and other system-specific questions to system-specific
> groups?
> 
> To answer the question anyway:  UNIX never promised to read exactly as
> many bytes as you ask for.  Most UNIX *implementations* happen to do it
> when the underlying file is a `disk file', but that is a side effect of
> the implementation, not a design feature.  I cannot speak for other
> operating systems.  Since you did not name the OS, the question is in
> fact unanswerable.
> -- 
> In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 510 486 5427)
> Berkeley, CA		Domain:	torek@ee.lbl.gov

Sorry, I should have been more specific:

	1. by `file descriptor' I mean a handle returned from open() on
	   a *disk* file.

	2. the OS is OS/2 2.0

	3. the compiler is GCC 2.1

/Doug
From: swanger@ducvax.auburn.edu
Newsgroups: comp.lang.c
Subject: Sort help needed - SOLVED!
Date: 13 Aug 92 13:03:34 GMT
Organization: Auburn University, AL

In article <1992Aug12.154130.1@ducvax.auburn.edu>, swanger@ducvax.auburn.edu writes:
> I am writing a program in C.  I have an array of character strings that
> I want to sort (I dynamically allocate the "array" with a series of
.
.
.
I want to thank all of the people who suggested that I use qsort() with my
program.  I works great, it is fast and I had it working in a few minutes.

Thanks again!
-- 
David Swanger,   Auburn University, Alabama,   swanger@ducvax.auburn.edu 
Xref: sparky comp.lang.c:12457 comp.sys.ibm.pc:426
From: cteague@ra.cs.umb.edu (Charles F. Teague II)
Newsgroups: comp.lang.c,comp.sys.ibm.pc
Subject: Using ANSI.SYS codes from C?  (Turbo)
Date: 18 Aug 92 01:39:12 GMT
Article-I.D.: cs.1992Aug18.013912.12547
Organization: University of Massachusetts at Boston


  Is there any way to use ANSI.SYS escape sequences from C?  (TurboC++v1.0)
I'm hoping to use this just to get a simple coloring of my text, without
using conio.h, and staggering cprintf()s with textcolor() and/or textattr().

  I've tried several different output fns, and none of them seem to be able
to do what a simple echo command in a batch file can do:  change the text
color by using ansi codes.  If anyone can help me out, I'd appreciate it.

	Thanks,
--
Charles F. Teague II  Net:cteague@cs.umb.edu  Real:33 Sidney Ave, Lynn MA 01902
+------------------------------------+-----------------------+----------------+
| Computers are so powerful because  | "Don't do what I SAY, | 'lush' CS 1993 |
| they do whatever you tell them to. |  do what I mean!!!!"  | TKE-zm sn 603  |
+------------------------------------+-----------------------+----------------+
Hi!  I'm a replicating .sig virus!  Join in the fun and copy me into yours!
From: bsullivn@sc.sni.ie (Bryan O'Sullivan)
Newsgroups: comp.lang.c
Subject: Re: Is "...", instead of ",..." legal ?
Date: 14 Aug 92 11:49:54 GMT
Article-I.D.: sc.157
Reply-To: bryan@sc.sni.ie
Organization: Siemens-Nixdorf Software Development Centre, Dublin
X-Newsreader: Tin 1.1 PL3



scott@megadata.mega.oz.au (Scott Humphreys) writes:

: My question is: is this legal : int foo (...);
: 
: That is - can I legally declare a function 
: with none or many arguments, or does it HAVE to have
: at least one argument.

What you suggest is illegal.  Gcc might let you get away with it, but
don't think about porting your code.  You need at least one argument.

	-- Bryan

-- 
Bryan O'Sullivan                                             +353-1-767551 x225
Siemens-Nixdorf Informationssysteme AG                          bryan@sc.sni.ie
Software Development Centre                    "Theory like mist on eyeglasses.
Dublin                                          Obscure facts." -- Charlie Chan
From: joe@proto.com (Joe Huffman)
Newsgroups: comp.lang.c
Subject: Re: Borland using MSC libs
Keywords: libs obj borland bcc msc
Date: 16 Aug 92 18:33:16 GMT
Distribution: comp.lang.c
Organization: Prototronics @ Sandpoint, Idaho

scotth@felix.filenet.com (Scott Hopson) writes:

>In article <1992Aug13.182240.15939@tamsun.tamu.edu> miller@eemips.tamu.edu (Kelly M Miller) writes:
>>
>>Is it possible to link in libs created under MSC 5.0
>>into a Borland C app? What must I include in the link?
>>the MSC libs? Must I exclude some of the Borland libs?
>>

>The answer is a big NO, although it might work for some functions
>Borland does not support linking of MSC Libs.

Practically speaking, you are correct.  But it is possible to build 
libraries that will link and run with multiple compilers.  The Flash
Graphics library that my company sells will link with Borland (including
use with Pharlap's 16-bit DOS extender), Microsoft, and Zortech (includeing
Rational System's '286 extender) with nearly all memory models.  It is
some extra work, but we figure we make up for it by not having to test
quite so throughly with all the variations.  We throughly test with once
compiler and all memory models and all graphics adapters then a cursory 
test with all compilers, all memory models, and one graphics adapter.

If you are interested in how to build such a library, send me email...

In general, this is not possible with C++.  This because the name mangling
is different between compilers.

-- 
netcom!proto!joe
joe@proto.com
Newsgroups: comp.lang.c,comp.programming
From: svenning@cc.curtin.edu.au
Subject: SEEKING C/C++ LIBRARIES (URGENTLY!)
Organization: Curtin University of Technology
Date: Tue, 18 Aug 1992 04:38:25 GMT

HELLO,
      
      I am urgently seeking C/C++ libraries for use in my project, as I am 
currently studying Comp Sys. Engineering at Curtin Uni (Australia).
I would be very grateful if anyone can provide me with either a number for
an FTP site which has such libraries or if they can directly provide me with
such information. My project revolves around a database system, which in 
particular, means that I am after GUI routines or search/sort algorithms.
  Any information regarding this matter would be appreciated.

                                               Regards,
                                                     Todd Venning.
                                            
                  e-mail: svenning@cc.curtin.edu.au






From: ramki@fakir.india.hp.com (R Ramakrishnan)
Date: Thu, 13 Aug 1992 10:46:26 GMT
Subject: Re: A LITTLE BRAINTEASER...
Organization: HP India Software Op., Bangalore
Newsgroups: comp.lang.c

Hi,

Here is the one you asked for. Hope this works.

Ramki
------------------------------------

#include	<stdio.h>

char reverse(ch)
char ch;
{
	if ((ch == '\n') || (ch == EOF))
		;
        else
	{
                reverse(getchar());
		putchar(ch);
	}
}

main()
{
	char ch;

	while ((ch = getchar()) != EOF)
	{
		reverse(ch);
		putchar('\n');
	}
}
--------------------------------------------------------