HDTenEightyP/NetNews huggingface dataset:
From: bjornmu@idt.unit.no (Bj|rn P. Munch)
Newsgroups: comp.lang.c
Subject: Re: Variable length records
Date: 26 Jul 92 12:49:15 GMT
Organization: Div. of CS & Telematics, Norwegian Institute of Technology

In article <1992Jul25.091702.15993@klaava.Helsinki.FI>, wirzeniu@klaava.Helsinki.FI (Lars Wirzenius) writes:
|> gurgle@netcom.com (Pete Gontier) writes:
|> >typedef struct
|> >{
|> >	short   count;
|> >   float   data[ ];
|> >}
|> >foo;
|> >
|> >I refer to the second member as an "open array." Its behavior is this:
|> >	o  it may appear only as the last member of a structure
|> >	o  it does not contribute to the value returned by sizeof(foo)
|> >   o  it may be addressed, of course, with an arbitrary index
|> 
|> Are there any particular reasons to not use
|> 
|> 	typedef struct {
|> 		short count;
|> 		float data[1];
|> 	} foo;
|> 

I was about to give the same comment.  I use a definition like the
above myself.  The expression for the size you need to "malloc" gets
more complex (as you need to subtract one), but I don't mind that.

|> (and similar over-allocation and using "too large" indexes) instead?
|> This version only assumes that there won't be any problems for accessing
|> elements outside the data array.
|> 
|> And, except for a minor gain in convenience for allocation and
|> deallocation, is either of these preferable to
|> 
|> 	typedef struct {
|> 		short count;
|> 		float *data;
|> 	} foo;

Even though the syntax for accessing the data will be the same, the
use of this form will "cost" you one additional pointer dereferencing.
If you use this structure a lot (as I do), it may make an (ok, rather
small) difference to the performance.

(It may also cost an extra malloc to set up)

---
Bj|rn P. Munch               | Dept. of Comp. Science & Telematics,
Bjoern.P.Munch@idt.unit.no   | Norwegian Institute of Technology (NTH),
PhD Student                  | N-7034 Trondheim, Norway
 (some filler words here)    | Fingerable addr:  bjornmu@multe.idt.unit.no
Newsgroups: comp.lang.c
From: Alan.Tai@bbs.oit.unc.edu (Alan Tai)
Subject: Balancing Binary Search Trees
Organization: Extended Bulletin Board Service
Date: Wed, 29 Jul 1992 01:48:21 GMT

I currently have a binary search tree to store an alphabetized list of
words, but would like it to be optimized for speed of retrieval.  Could
someone please post some example code for balancing binary trees, or
even suggest a book that might have this code.  So far, I haven't come
across any texts that have this, though.  Thanks!

Alan

Alan.Tai@bbs.oit.unc.edu

--
   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
From: bigham@acpub.duke.edu (Scott Bigham)
Newsgroups: comp.lang.c
Subject: Re: About the 'F' in RTFM
Date: 29 Jul 92 23:17:51 GMT
Organization: n. Arrangement in an orderly or logical fashion.  See "miracle".

From the Holy Book of <1992Jul26.190928.20817@mksol.dseg.ti.com>
  as spake by mccall@mksol.dseg.ti.com (fred j mccall 575-3539) :

>In <1992Jul23.155203.11430@newshost.lanl.gov> jlg@cochiti.lanl.gov (Jim Giles) writes:

>>The usual interpretation of the F is an accurate description of the quality
>>of most UNIX manuals.  The correct response to `RTFM' is "I *did* read it,
>>and it didn't answer the question I wanted answered."

>At which point, of course, you reach up, pull down the appropriate 
>manual, open it up, drop it in front of them and point.  They then
>say, "Oh," and walk away looking sheeplike.

Yeah, if they're sheep.  My usual response at this point is, "Yes, I
read that, and it doesn't answer my question.  I also read the next
three manuals on your shelf and they don't answer my question either.
If they did, I wouldn't be here asking you, now would I?"

						-sbigham
-- 
Scott Bigham                   | The opinions expressed above are
bigham@hercules.acpub.duke.edu | (c) 1992 Hacker Ltd. and cannot be
                               | copied or distributed without a
                               | Darn Good Reason(tm).
From: chris.lincoln@wugate.wustl.edu!travel (Chris Lincoln) 
Newsgroups: comp.lang.c
Subject: Borland 3.1 ext. mem. cap
Date: 23 Jul 92 06:22:00 GMT
Distribution: world
Organization: Travel Online, St. Louis, MO, USA
Reply-To: chris.lincoln@wugate.wustl.edu!travel (Chris Lincoln) 

VA.From: rdw@vax5.cit.cornell.edu
VA.Newsgroups: comp.lang.c
VA.Subject: Borland 3.1 ext. mem. capabilities?
VA.Message-ID: <1992Jul21.174042.13890@vax5.cit.cornell.edu>
VA.Date: 21 Jul 92 21:40:42 GMT

VA.Dear fellow MS-DOS C programmers:

VA.     I am a Microsoft C 6.0 user thinking of switching to Borland C++ 3.1.  M
VA.main concern is accessing about 7 megs of extended memory past the 640K limit
VA.imposed by DOS.  I am already using large linked lists rather than
  ...text omitted...
VA.thoughts on or reactions to Borland's product would be much appreciated.

  Borland C is just fine.  I use both BC++ 3.1 and MSC/QC on a daily basis.
  FYI: Were you aware that MSC has included a suite of virtual memory
  allocation functions in the 7.0 RTL?  (here, virtual memory means paging
  to EMS/XMS/Disk ).  I haven't tried them on for speed, yet.
---
 . SLMR 2.0 . Virtual workspace, Virtual Office, Virtual Job
                                                                                                         
Newsgroups: comp.lang.c
From: kfw@ecrc.de (Kam-Fai Wong)
Subject: Seeking for Graph and Window Editing package
Organization: European Computer-Industry Research Centre GmbH, Munich, Germany
Date: Fri, 24 Jul 1992 09:47:40 GMT




           Seeking for C Graph and Window Editing Packages
           ===============================================
     
     We are currently implementing a  simulator  and  planned  to
     provide  it  with a user interface system.  To implement the
     interface system we are seeking for software packages  which
     provide  graph  (i.e.  nodes  interconnected with archs) and
     window drawing capabilities.
     
     Our programming language is C; and we'd  like  the  software
     packages  to  be  based  on  Motif.  Do you know if any such
     packages are available in the public domain?
     
     Cheers,
     Kam-Fai
     
     
==============================================================================
	Kam-Fai Wong 			
	European Computer-Industry Research Center (ECRC) GmbH
	Arabellastrasse 17		
	D8000 Munich 81
	Germany
	E-mail: kfw@ecrc.de (INTERNET)
	Tel :	+49 89 92699 203
	Fax :	+49 89 92699 170
From: rdw@vax5.cit.cornell.edu
Newsgroups: comp.lang.c
Subject: Borland 3.1 ext. mem. capabilities?
Date: 21 Jul 92 17:40:42 EDT
Distribution: comp
Organization: Cornell University

Dear fellow MS-DOS C programmers:

     I am a Microsoft C 6.0 user thinking of switching to Borland C++ 3.1.  My
main concern is accessing about 7 megs of extended memory past the 640K limit
imposed by DOS.  I am already using large linked lists rather than
multidimensional arrays to conserve memory, but I still need more.  Does anyone
know about Borland's Extended Memory Interface or its VROOM features?  For
example, will it let me access this much memory?  Is there a counterpart in
Borland C++ to Microsoft's _huge pointers?  Can I mix memory models with
Borland (i.e. _huge pointers with a large memory model compilation)?  Any other
thoughts on or reactions to Borland's product would be much appreciated.

     Please post any responses on this newsgroup, as I don't have a EMAIL
address yet.

		Thanks,

		   Aaron S. Chou
		   Cornell University
    


Newsgroups: comp.lang.c
From: Ross Ridge <ross@zooid.guild.org>
Subject: Re: HIgher problems at hand. HELP!
Organization: ZOOiD BBS
Date: Wed, 29 Jul 1992 03:18:20 GMT

Ross Ridge <ross@zooid.guild.org> writes:
>But who knows what's >in <string.h> so it would be better if the "#define
>const" was placed after the "#include <string.h>". 

darcy@druid.uucp (D'Arcy J.M. Cain) writes:
>Except that the whole point is to prevent any warnings with full checking
>turned on.  Putting the define after the include would cause warnings
>when strstr was redefined. 

If strstr() is declared in <string.h> then why are we redefining here?
Wouldn't it already be in the standard library?

>Other than changing the language itself I don't believe there is a "right"
>way to code strstr(3).

What's wrong with "return (char *)s;"?

							Ross Ridge

-- 
Ross Ridge - The Great HTMU					     l/	 //
								    [OO][oo]
ross@zooid.guild.org						    /()\/()/
uunet.ca!zooid!ross						     db	 //
Newsgroups: comp.lang.c
From: russpj@microsoft.com (Russ Paul-Jones)
Subject: Re: My view of variable naming conventions (was: Hungarian...)
Date: 30 Jul 92 19:15:31 GMT
Organization: Microsoft Corporation
Followup-To: comp.programming

This really isn't a C issue, so I've directed followups to comp.programming.

In article <1992Jul27.013310.24591@uwm.edu> markh@csd4.csd.uwm.edu (Mark William Hopkins) writes:
>
>Experience with my own code and other people's code have borne out this
>assessment time and time again:
>
>    If you find yourself reverting to Hungarian Notation,
>    then you've violated all the [below], (0) through (5).
>

I'm not sure what you mean.  If you mean that you only need to resort 
to Hungarian when you've already broken the rules, I'll disagree by 
saying that I start with Hungarian in new code.  For those rules that 
I agree with, I find Hungarian a good implementation.  If you are saying 
that Hungarian itself violates these rules, well:

>I've always followed these rules in naming objects, like variables in C (or
>Pascal):
>
>(0) Declare as close to 0 variables and parameters at any scoping level as
>    possible.

Hungarian neither requires nor encourages extra variables and parameters.  
It does encourage extra typedefs, but you can control this.

>(1) Declare all objects as local as possible, even within a statement block.

Hungarian is a naming convention, not rules on where to declare the objects.

>(2) Use generic names for generic objects, and short, common (and appropriate)
>    natural language words for objects with semantic content.

Hungarian establishes short, common names with semantic content for generic 
objects.  They are not natural language words, but I believe it is easier 
to establish short names with semantic content using Hungarian than in 
casting about for appropriate natural language words for objects.

>and these rules:
>(3) If you have to comment on a variable's use, then you've named it wrong.
>    Rename it.

Using Hungarian, I almost never comment on a variable's use.  The point of 
the name is to define its use.

>(4) If you run into numerous name clashes, then you've violated (0) and (1).
>    Eliminate the extraneous fluff.

Properly used Hungarian will in fact show up violations of (0) and (1), as 
you are supposed to use identical names for objects being used in 
identical ways.

>(5) If you find yourself getting confused about types, then you're not
>    thinking straight about what your program is supposed to be doing.
>    Go back to the drawing board.
>

Again, Hungarian is not about types, it is about usage.  Is this rule 
saying that random variable names in code are OK as long as the programmer 
is thinking straight about what the program is supposed to be doing?


I still have a 40K document describing a dialect of Hungarian close to 
what I use.  This dialect is distinct from that used in the Windows SDK 
documentation.  It is available on e-mail request.  Most of the discussion 
on Hungarian that I've seen has nothing to do with the naming convention 
I use.

-Russ Paul-Jones
russpj@microsoft.com
As far as I know, Microsoft does not endorse Hungarian notation.
From: limes@ouroborous.Eng.Sun.COM (Greg Limes)
Newsgroups: comp.lang.c
Subject: Re: "fork"/"vfork" on the SUN
Date: 25 Jul 1992 01:39:22 GMT
Organization: Sun Microsystems, Inc.
NNTP-Posting-Host: ouroborous

In article <1992Jul24.205152.25492@exu.ericsson.se> exujuyu@exu.ericsson.se (Junwen Yuan) writes:
>Is there any other easy way, other than "vfork()", to let a forked
>child share the same data object as its parent?

Yes. Put the object in shared memory, by mapping the memory from a file
and using the MAP_SHARE flag. See the documentation on "mmap".
Newsgroups: comp.lang.c
From: dealy@kong.gsfc.nasa.gov (Brian Dealy - CSC)
Subject: ANSI C compilers for Sparcs - vendors? comments?
Keywords: compiler ANSI Sun 
Reply-To: dealy@kong.gsfc.nasa.gov (Brian Dealy - CSC)
Organization: Goddard Space Flight Center
Date: Fri, 31 Jul 92 20:02:28 GMT



-- 
Hi, 
	Maybe this is a frequently asked question but this is a first
	time for me on this group so if so I apologize. I am looking
	for vendors of ANSI c compilers for the Sparc and would like to hear 
	from anyone who has opinions good or bad about a specific ANSI c 
	compiler. I thank you.

Brian Dealy
dealy@kong.gsfc.nasa.gov

	Please email me as I do not read this group often . thanks again
Newsgroups: comp.lang.c
From: drd@siia.mv.com (David Dick)
Subject: Re: MUMPS programming language (history)
Keywords: MUMPS M
Organization: Software Innovations, Inc., Nashua, NH
Date: Wed, 29 Jul 92 15:33:46 GMT

We designed and implemented a language we called "AVL" (although
we couldn't sell it under that name because "Audio Visual Labs
objected -- so we call it "Proto-C").

It was a marriage of C control syntax with the Mumps datatype.

We developed it on a machine with 64K I-space and 64K D-space (
an Onyx, if you must know), so we provided dynamic function linking.

It was a lot of fun to work with, without some of the cryptic
aspects of Mumps.

David Dick
Software Innovations, Inc. [the Software Moving Company]



Newsgroups: comp.lang.c
From: kencham@ulysses.cs.umn.edu (Deepak)
Subject: Function name : C preprocessor question
Followup-To: comp.lang.c
Organization: University of Minnesota
Date: Thu, 30 Jul 1992 22:43:32 GMT

O, C-gurus !!

I was wondering if there was anyway to get the name of function that is being currently executed. The scenario is as follows : 

Suppose you have a debugging macro that is defined as follows :

#define DEBUGSTR(x)  fprintf(stderr , "In File : %s , Function :%s error : %s"\
			__FILE__ , <GOD-KNOWS-WHAT> , x )

and somewhere in file foobar.c I have the following code :

....
...
.
foobarfunction(foobarvar)
foobarstruct foobarvar;
{
int foo;

	if ( foobarvar == 0 ) DEBUGSTR("foobarvar was zero");
	blah !
	blah !!
	blah !!
}
.
..
...

The result should be that if foobarvar happened to be 0 then the following should be printed on stderr.

In File : foobar.c , Function :foobarfunction error : foobarvar was zero

Is it possible to do this using the preprocessor without passing the name of the function as an additional argument to the macro ?

Silly question ,eh ?

Deepak
-- 
********************************************************************************
*  Deepak R. Kenchammana-Hosekote            		*******     ******     *
*  Dept. of CSci, University of Minnesota    		 ***  *** *** ***      *
*  1:((612) 626-8396(o),(612) 339-8997(r))     		 ***   *****  ***      *
*  kencham@ulysses.cs.umn.edu 		       		*****        *****     *
********************************************************************************
Newsgroups: comp.lang.c
From: mox@vpnet.chi.il.us (William Moxley)
Subject: Checking variables for characters & Copying portions of strings
Organization: Vpnet Public Access
Date: Mon, 27 Jul 1992 15:13:45 GMT

 
Sorry if this question seems to be a bit basic, I'm new at this...
 
I'm adding an editing feature to a little database I wrote.  I need
to be able to see if a certain variable has anything but whitespace
in it.  (So that you can just hit enter past some of the fields
instead of having to retype everything)  How can I do this?  I've
tried strlen and sizeof, but they just tell me how big the string
is defined for.
 
Also, an unrelated question.  How can you copy a portion of a string
into another?  What I want to do is to take a part out of the middle
section of string 1, and put it in the middle section of string 2.
I've looked at strncpy, but I don't know if/how it's possible to
make it start from the middle of a string.
 
Any help will greatly be appreciated.  And if it matters, I'm using
Borland C++ on an IBM compatible machine.
 
                        William Moxley
                        mox@vpnet.chi.il.us
Newsgroups: comp.lang.c
From: kardanev.lepapp.none@hanoi.cern.ch (A. Kardanev)
Subject: Re: linking gcc code with CC code
Organization: European Laboratory for Particle Physics (CERN) Switzerland
Date: Fri, 31 Jul 1992 08:44:45 GMT

In article <1992Jul30.182047.18971@news.columbia.edu> kps@cunixb.cc.columbia.edu (Karthik P Sheka) writes:
   Is it possible to link gcc created object files with CC created object
   files?  I've tried doing so but it seems that the c functions cannot call
   the c++ functions, even though the c++ functions are not in any class.
   Sample code follows... (The error returned is Undefined symbol: routine2)

   /*****C++ code*****/
   #include <iostream.h>
   extern "C"{
   int routine1(void);
   };

   int main(void)
   {
     cout << routine1();
   }
   static int routine2(void)
   {
     return 2;
   }


   /*****C code*****/
   extern int routine2();

   int routine1(void)
   {
     return(routine2());
   }

Just change your C++ code to:
/*****C++ code*****/
#include <iostream.h>
extern "C"{
int routine1(void);
int routine2(void);		// Added this for calling from usual C
};

int main(void)
{
  cout << routine1();
}
int routine2(void)		// Removed "static" declaration to make this
				// routine "global"
{
  return 2;
}


Hope this help... but there may be some other problem in compatibility
your gcc and CC...
--
-------------------------------------------------------------------------
 KARDANEV Alexandre			| SL Division	
 Email: kardanev@hanoi.cern.ch		| Building 864, 1-A02		
 Voice:    + 41-22-767-5165		| CERN 1211 Geneva 23		
					| Switzerland			
-------------------------------------------------------------------------
From: dave@cs.arizona.edu (Dave Schaumann)
Newsgroups: comp.lang.c
Subject: Re: learning C?
Date: 29 Jul 92 23:15:44 GMT
Reply-To: dave@cs.arizona.edu (Dave Schaumann)
Organization: University of Arizona

In article <1683393E.RJONES1@ua1vm.ua.edu>, RJONES1@ua1vm (Bart Jones) writes:
>   What advice would you all give to a (very) novice who wants to learn C
>on the Mac?

Unless you're very confident of your ability (but then, if you were, you
wouldn't have posted), I'd say don't try it without help.  At the very
least, you should have someone close at hand that can help you out when
you get stuck.

C is full of the sorts of things that can cause behaviour the novice
programmer will find utterly unexplainable.

>Where would I start, and with what?  Books?

I understand that many people like _A Book on C_, by Pohl & Kelly as a
good tutorial.  _The C Programming Language_ by Kernighan & Ritchie is
the cannonical definition.

>Reference?

_C: A Reference Manual_ by Harbison & Steele is an excellent reference
book, and often goes into detail on fine points that other books ignore
or gloss over.

>Programs,

This depends on what you require, and what machine you're using.  If you're
looking for support programs, try posting in the appropriate comp.sys
group.  

-- 
Mary had a swingin' lamb/he followed her to
	school

She hocked his wool for a bongo drum and man that lamb was
	cool.

		-Mr. Know-it-all
From: tlg@uknet.ac.uk (Tim.Goodwin)
Newsgroups: comp.lang.c
Subject: Re: Concatenation of two macros?
Date: 23 Jul 92 17:34:12 GMT
Organization: UKnet

In article <1FE7B81211DF800725@ursula.lucas.lu.se> KOSU_MATSB@ROUTH.KOSUFY.LU.SE writes:
>
>	Concatenation of two macros. Is it possible?
>
>	If i have the following two definitions:
>		#define A pre
>		#define B post
>	And want to "#define C" to be  "prepost" BUT as an 
>	expression of A and B! How do i do it?
>	#define C (expression of A and B to yield prepost)

This is alluded to in the FAQ (question 5.2).  You need the token
pasting operator ##.

    #define A pre
    #define B post
    #define C A ## B

This is highly unlikely to work on a pre-ANSI compiler: if you're stuck
with such a beast you *may* be able to use

    #define C A/**/B

instead.

Tim.
-- 
The GNU is in fact the legendary and much-berated | ; who am i
feeping creature - Malcolm Wallace.               | uknet.ac.uk!tlg
Newsgroups: comp.lang.c
From: mitchell@mdd.comm.mot.com (Bill Mitchell)
Subject: Re: Handling signals (was:  trapping "control C")
Bcc:  mitchell
Reply-To: mitchell@mdd.comm.mot.com (Bill Mitchell)
Organization: Motorola, Mobile Data Division - Seattle, WA
Date: Tue, 21 Jul 1992 14:47:05 GMT

in comp.lang.c, atbowler@thinkage.on.ca (Alan Bowler) said:


>In article <1992Jul18.164658.14314@oracle.us.oracle.com> wkaufman@us.oracle.com (William Kaufman) writes:
>>In article <1992Jul17.141248.4837@mdd.comm.mot.com> mitchell@mdd.comm.mot.com (Bill Mitchell) writes:
>>
>>    OK, so this just says that the signal handler should be *very*
>>careful about touching global variables, right?  Doing nothing,
>>exit()'ing, or writing to a variable that the main program only reads
>>from (or vice versa)--these should all be safe, right?
>>
>Actually "exit()'ing" can be a bit dicey.

I won't argue with that.

I do want to point out, however, that the snippet seemingly attributed to me
above was actually written by Bill Kaufman.

-- 
mitchell@mdd.comm.mot.com (Bill Mitchell)
Newsgroups: comp.lang.c
Subject: Re: URGENT HELP NEEDED:  crash upon redirection...
From: schectr@ucunix.san.uc.edu (ROBB SCHECTER)
Date: Tue, 28 Jul 92 06:12:19 GMT
Organization: University of Cincinnati

(Dave Schaumann) writes:
>I write:
>>-> I am too inexperienced with C on UNIX (and gcc) to know if I'm doing
>>   something obvious, or even where to look for errors.
>
>If the class is over you're head, you're better off talking to the
>instructor than getting answers you don't understand from the net.
>
   Actually, NO, this class is too -easy- for me; I just finished designing my
own graphical user environment and companion interpreter to learn C on my own.
As I said, I'm inexperienced with C on --UNIX--.  Thanks for the advice about
"gdb".
-- 
---------------------------------------------------------------------------
Robb Shecter        University of Cincinnati      schectr@ucunix.san.uc.edu
                                                  ^^^^^^^
                 My university cannot spell my name...