HDTenEightyP/NetNews huggingface dataset:
From: dave@cs.arizona.edu (Dave Schaumann)
Newsgroups: comp.lang.c
Subject: Re: POWER OF LARGE NUMBERS
Date: 17 Aug 92 06:02:43 GMT
Reply-To: dave@cs.arizona.edu (Dave Schaumann)
Organization: University of Arizona

In article <QUANSTRO.92Aug16132245@mari.StOlaf.edu>, quanstro@mari (goon) writes:
>In article <1992Aug16.052157.1991@organpipe.uug.arizona.edu> dave@cs.arizona.edu (Dave Schaumann) writes:
>
>   >>	Does any one know how to raise power of possibly 100 digits 
>   >>to possibly 100 digits. Any algorithm or code will be appriciated.
>   >
>   >Is there any hope of solving this?
>
>   Only if you're willing to give up most of the significant digits.
[...]
>
>You just contradicted yourself. It is possible. It just takes more
>memory and more programming (you can't expect the hardware to handle
>this sort of case). Check out the man page for mp (a set of arbitrary
>precision arith. functions) if you are on a UNIX system. There is also
>a GNU version of these functins.

Take a look at the specification again.  We're talking about calculations
that will yield results with 10 ** 10 ** 100 digits.  Try to do that with
a so-called `arbitrary precision' software package, and you'll find out
that it wants memory for that precision.  We're talking about numbers so
hugely vast we can't even talk about how many *digits* they have without
using exponents!  A megabyte has (about) 10**6 bytes in it, so we're talking
about 10**94 megabytes just to hold the result.  Suppose you can load 1
megabyte in a 10**-12 seconds (new warp-drive technology), it would take you
10**78 seconds to load your value.  That's more than 10**71 years.

So I restate my point: yes, you can write software to deal with numbers
that large, but NOT without dropping 99.9% of your accuracy.

-- 
Dave Schaumann			dave@cs.arizona.edu
From: jerry@synopsys.com (Jerry Huth)
Newsgroups: comp.lang.c
Subject: Re: Computer terms, etc
Date: 13 Aug 92 19:24:56 GMT
Organization: Synopsys Inc.


Scott Hopson (scotth@filenet.com) says:
>> > and what is the diff. between  *foo[] and **foo?
>> *foo[] is a pointer to an array

No, it's an array of pointers, because [] has higher precedence than *.
From: amayes@hemel.bull.co.uk (Andrew Mayes)
Newsgroups: comp.lang.c
Subject: Re: meaning of '..\dos\crt0.asm ' error in msc 6.0
Keywords: startup,MSC6.0,crt0.asm
Date: 20 Aug 92 09:13:27 GMT
Distribution: na
Organization: Bull HN UK

paul@gaitlab1.uwaterloo.ca (paul j guy) writes:

>	Every once in a while I get a message from PWB (programmers
>work bench, MSC6.0) complaining that \dos\crt0.asm does not exist. Then
>the linker bitches about one of the library files (or even crt0.obj).
>I get an error L2029 '_main' unresolved external. 
	....

>	-Paul

This error is normally caused by 'making' the target before you have loaded 
the makefile. If the module you are editing is not the one with main in it 
will still compile it but the errors you specify will be produced.
Also note that if your makefile is not using the small model you should
recompile any modules compiled when the makefile wasn't loaded as make doesn't
know which model was used to compile a file.
Xref: sparky comp.lang.c:12635 comp.unix.programmer:4402
From: bsullivn@sc.sni.ie (Bryan O'Sullivan)
Newsgroups: comp.lang.c,comp.unix.programmer
Subject: Re: memory map (mmap)
Date: 17 Aug 92 10:10:30 GMT
Article-I.D.: sc.159
Reply-To: bryan@sc.sni.ie
Organization: Siemens-Nixdorf Software Development Centre, Dublin
Followups-To: comp.unix.programmer


X-Newsreader: Tin 1.1 PL3


ddewar@cbnewsb.cb.att.com (derek.a.dewar) writes:
:A quick questions about the mmap function in C....

Minor semi-pedantic issue: your question should have been directed to
comp.unix.programmer; it's got nothing much to do with the C language in
general, as far as I can see.  Anyway ...

:After  mapping the contents of a file into memory using the 
:mmap function, I tried to write something to the mapped segment
:using write(2). I thought this would change the memory copy only,
:but when I use the debugger I find that actaul contents of the file
:have been changed as well as the memory image. My questions is,
:what does "write" actually write to ? The memory image, or the file ?
:(or both ?)

Write(2) writes to the file; I'm not sure whether or not changes to the
file in this fashion are reflected in the mapped pages (I think they
are).  You seem to have misinterpreted the use of mmap: it is used to
write to a file without the direct overhead of a write() systems call
for every change you make.  It is _not_ intended to allow you to read in
a file and change its image in memory only.

: If it's the file, what function can I use to alter the contents of the
: memory image only, to eliminate any need for disk I/O overhead ?

You'll have to roll your own.  Try something like the following:

--------

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

struct foo {
	off_t size;
	void *addr;
};

struct foo *readall(char *path)
{
	struct stat buf;
	struct foo *bar;
	int fd;

	if ((fd = open(path, O_RDONLY)) < 0) {
		perror("open");
		exit(1);
	}
	if (fstat(fd, &buf) < 0) {
		perror("fstat");
		exit(1);
	}
	if ((bar = malloc(sizeof(struct foo)) == NULL) {
		perror("malloc");
		exit(1);
	}
	if ((bar->addr = malloc(bar->size = buf.st_size)) == NULL) {
		perror("malloc");
		exit(1);
	}
	if (read(fd, bar->addr, bar->size) < 0) {
		perror("read");
		exit(1);
	}
	return bar;
}

--------

The above should read the entire file into a dynamically-allocated block
of memory and return a pointer to a structure describing the allocated
block.  It does no checking to see if you're trying to read a fifo or
special file (in which case buf.st_size is undefined).

	-- 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: georgec@pongnet.chi.il.us (George Carrillo)
Newsgroups: comp.lang.c
Subject: I need help on amiga C graphic programing
Date: 10 Aug 92 20:14:07 CST
Organization: Temple of Pong BBS - (708)268-1603

ok  I am writting video games and am having touble with the amiga/graphics
library routine called  BltMaskBitMapRastPort();  I am using 0xee as a minterm
and I'm getting garbage... I have checked my rastports and bitmaps and am at a
standstill right now... pleas help 
Newsgroups: comp.lang.c
From: karl@ima.isc.com (Karl Heuer)
Subject: Re: Sorting (continued)
Organization: Interactive Systems, Cambridge, MA 02138-5302
Date: Tue, 18 Aug 1992 17:51:14 GMT

In article <1992Aug15.135836.23357@midway.uchicago.edu> pynq@midway.uchicago.edu writes:
>[How to sort a number of records, the count not being known in advance?]
>
>[1.  keep an array of records and |realloc()| them as needed]
>(I am assuming that realloc does recopy the data if it needs
>to move the block - this re-copying could be costly)

If you grow the size of the array exponentially, the recopy requires only
linear% time.  You also have a linear% amount of wasted space, which can be
reclaimed with a final, shrinking |realloc()|.

>[2. Use a linked list]  Now, you don't have to do any reallocs, but at the
>end, you have to traverse the list, and build an array of pointers to the
>things and qsort that.

Only if you're dead set on using the |qsort()| routine.  You could use a merge
sort that can process a linked list in O(n*lg(n)) time.

>3. Build a binary tree in the first pass, then simply print the tree in
>traversal order.

If you're using the obvious algorithm, where the first record becomes the root
and each record's position relative to the root is permanently assigned after
reading it in, then this becomes O(n^2) for cases where the original input is
already sorted or reverse-sorted.

Karl W. Z. Heuer (karl@ima.isc.com or uunet!ima!karl), The Walking Lint
________
% Linear as a function of the final size of the array, that is.
Newsgroups: comp.lang.c
From: qualtrak@netcom.com (Qual Trak)
Subject: Re: general tree
Date: Wed, 12 Aug 92 15:05:40 GMT
Organization: QualTrak Corporation

In article <1992Aug12.092635.27271@ugle.unit.no> bjornmu@idt.unit.no (Bj|rn P. Munch) writes:
>In article <chuckb.713584418@milton>, chuckb@milton.u.washington.edu (Chuck Bass) writes:
>|> bjornmu@idt.unit.no (Bj|rn P. Munch) writes:
>|> 
>|> >In article <1992Aug11.200208.19716@infonode.ingr.com>, dpm@wizard.b29.ingr.com (David Mikesell) writes:
>|> >|> 
>|> >|> I am beginning work on a C program that will manipulate a general tree, i.e.
>|> >|> a tree in which each node can have an arbitrary number of children.  An ex-
>|> >|> ample declaration of the structure follows:
>|> >|> 
>|> >|> struct node
>|> >|> {
>|> >|>     DATA        data;
>|> >|>     struct node *parent;
>|> >|>     struct node **children;
>|> >|> };
>|> 
>|> >In stead of putting the children into an array (what do you do if this
>|> >array suddenly isn't big enough?), you may consider putting them in a
>|> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>|> This is a perfect time to use something like ... realloc.
>
>I also thought about realloc(), but soon realized this would be a
>rather bad idea.  Maybe I should have explained why...
>
>Remember: realloc() may move your array to another address.  If you
>have references to the children that were stored there (like parent
>pointers in _their_ children), then you're in deep trouble.
>

Seems to me realloc () will work quite adequately if you reference the
children pointer explicitly thru the node - i.e.
	struct node *nodeptr, (nodeptr1;

	nodeptr1 = nodeptr->children [0];

Will always return you the same value even if nodeptr->children has been
realloced ();

------------------------------------------------------------------------
John Birchfield - QualTrak Corp (408) 730-2674 Home (408) 736-3852
jb@QualTrak.COM
------------------------------------------------------------------------
From: scotth@felix.filenet.com (Scott Hopson)
Newsgroups: comp.lang.c
Subject: Re: Computer terms, etc
Date: 15 Aug 92 19:43:19 GMT
Reply-To: scotth@fritz.filenet.com (Scott Hopson)
Organization: FileNet Corp., Costa Mesa, CA

In article <1992Aug13.192456.19127@Synopsys.Com> jerry@synopsys.com (Jerry Huth) writes:
>
>Scott Hopson (scotth@filenet.com) says:
>>> > and what is the diff. between  *foo[] and **foo?
>>> *foo[] is a pointer to an array
>
>No, it's an array of pointers, because [] has higher precedence than *.

Sorry, it was 2:00 AM when I wrote that, I guess I forgot to put
"of pointers" on the end.


*foo[] is a pointer to an array [of pointers]


thanks for the correction.

-- 
Scott Hopson   (scotth@filenet.com)
Newsgroups: comp.lang.c
From: mjn@pseudo.uucp (Murray Nesbitt)
Subject: Re: spin the wheel
Organization: Private system in Toronto, ON
Date: Wed, 19 Aug 1992 08:48:54 GMT


U56779@uicvm.uic.edu writes:

>Can anybody tell me a code in c to spin the wheel after drawing it.
>thanks...

This question *is* in the frequently-asked-questions list, but for
your benefit...

% man spinthewheel


     Name
	  spinthewheel - spins the wheel after drawing it.

     Syntax
	  int spinthewheel (wheel, direction)
          wheel *wheel;
          int direction;

     Description
          spinthewheel spins the wheel after drawing it.  The first
          argument is a pointer to the wheel to spin; the second is
          the direction in which to spin the wheel, and must be
          assigned one of the following:

          LEFT  - spin the wheel left
          RIGHT - spin the wheel right

     See Also
	  drawthewheel(S), rotatethewheel(S)

     Note
          The spectral properties of spinthewheel are limited.
          rotatethewheel provides a much better, more elaborate,
          wheel spinner.
% 

Murray
-- 
I've got tapes, I've got C.D.s  |  Murray Nesbitt  - mjn@pseudo.uucp
I've got my Public Enemy        |
From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius)
Newsgroups: comp.lang.c
Subject: Re: Help with function typedef.
Date: 15 Aug 92 09:41:38 GMT
Organization: University of Helsinki

jimh@ultra.com (Jim Hurley) writes:
>typedef unsigned char CLI_RETURN_CODE;
>typedef CLI_RETURN_CODE (*CLI) (int, char **);

This defines `CLI' as a `pointer to function returning unsigned char and
having two arguments, an int and a pointer-to-pointer-to-char'.  Note
the difference between function and pointer-to-function.

>/* prototype */
>CLI cli_help;

I get the feeling that this tries to create a prototype for a function
`cli_help', but it does in fact define only a pointer to a function.

>CLI_RETURN_CODE cli_help (int argc, char **argv) {

This defines `cli_help', which was already defined above as a pointer to
a function as a function.  Since pointers and functions are different,
this correctly results in an error.  Probably the correct way to fix
things is to write the prototype to be

	CLI_RETURN_CODE cli_help (int argc, char **argv);

After this, the name `cli_help' can be used to initialize pointers of
type CLI, due to the fact that the name of a function, when used alone
and not for calling the function, is a pointer to the function (not
quite unlike the fact that the name of an array is a pointer to its
first element, in value contexts). 

>x.c:17: initializer for static variable is not constant

I lost track of lines, but I think this message was for the
initializion of the structure (which I deleted), one field of which was
a pointer to a function initialized with `cli_help'.  Since `cli_help'
was a pointer with a non-constant value, it is an error to use its value
to initialize a global or static variable.  By changing the definition
of `cli_help' as a pointer into a prototype for a function we also make
the initializion legal, since now the value of `cli_help' (a pointer to
a function) is constant.

--
Lars.Wirzenius@helsinki.fi
From: ebazergh@gmuvax.gmu.edu
Newsgroups: comp.lang.c
Subject: WANTED: Serial port data exchange code
Date: 22 Aug 92 17:54:49 -0500
Organization: George Mason University, Fairfax, VA.

I'm looking for code which can help me add an HEAD-TO-HEAD modem play
feature to a game I am currently writing for IBM Compataibles.
What I need is the basic way of getting the computers on both sides to wait
until the other is ready, then the actual exchange of info while the
game is being played. I already have a library of serial routines, so please
don't send me a reply with library names. I need actual code or even
pseudo-code in order to help me implement this feature.
 
Can anyone help me?
 
THANX!
 
P.S. Please reply by E-MAIL, I rarely visit this newsgroup...
 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 Eric R. Bazerghi                    |      BitNet:  EBAZERGH@GMUVAX.BITNET
 Student                             |    InterNet:  EBAZERGH@GMUVAX.GMU.EDU
 George Mason University             |-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 4400 University Drive               |  What do you have when a room is half
 Fairfax, VA  22032                  |  full with women who have PMS and half
                                     |  full with women with yeast infections?
                                     |  A whine and cheese party!
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
Newsgroups: comp.lang.c
From: jmwojtal@vela.acs.oakland.edu (Wojo)
Subject: C++ for windows. A few questions
Organization: Oakland University, Rochester MI.
Date: Wed, 19 Aug 1992 15:51:27 GMT

The company I work for is expanding their computer system, and plans to use
DecWindows.  We're looking into getting C++, an object oriented code that can
not only run windows, but create them as well.

Our main concern now is how easy (or difficult) is it to learn this new
software package?  The company would like to have it, but if it takes weeks to
learn it...

Please E-mail you comments.

Thank you.


-- 
************************************************************************
Jeff Wojtalewicz (Wojo)  jmwojtal@vela.acs.oakland.edu
Oakland University		      Start Hacking
************************************************************************
Newsgroups: comp.lang.c
From: baillie@cs.mu.OZ.AU (Stephen Baillie)
Subject: Re: Question about MS C/C++ Compiler 7.0
Keywords: MS C/C++ Compiler 7.0
Organization: Computer Science, University of Melbourne, Australia
Distribution: inet
Date: Sun, 23 Aug 1992 07:52:23 GMT

castello@remus.rutgers.edu (Vicente Castello) writes:

>	I have had the opportunity of experimenting with the latest C
>compiler from Microsoft. While running a few tutorials, I have
>encountered a few problems. The problem that I get most often deals
>with memory. 
>	When I compile the single-module programs from the tutorial,
>the program is compiled, linked, and executed successfully. However,
>when I try to compile a multi-module program, I am always getting an
>error that complains about the lack of far heap space. This error is
>associated with a lack of memory. 
>	If you have experienced this same problem with this compiler,
>I would appreciate if you can offer solutions. The programs that I
>am trying to run are small. I am not dealing with code of 25,000
>lines.
>	I am running the Programmers Workbench straight from DOS.
>Since I am not using Windows, I have installed 386MAX in order to run
>my programs from DOS. Before I run PWB, I have 625K available in the
>low-DOS area. The machine that I am using is a 386/20 with 4MB of RAM.

We've had similar problems from time to time along these lines.  The cause
in our case was that we were using a make utility that grabbed a little
too much memory.  So if you're using a make function you could try doing
the compiles "manually".

If you're not using a make, just compiling multiple modules, you may need
to compile the modules separately with the -c flag to produce just object
modules, and then run the "link" program to put them all together.

Hope this helps,

Steve.
From: jrv@truth.uucp (Vanzandt)
Newsgroups: comp.lang.c
Subject: Re: Scaled random number (Was: Matt Dillon's DICE (Amiga C) and rand() function)
Date: 19 Aug 92 19:31:51 GMT
Organization: The MITRE Corp., Bedford, Ma.

In article <1992Aug19.175913.29022@linus.mitre.org> jrv@truth.uucp (Vanzandt) writes:
>In article <4476@teslab.lab.oz.au> andrew@teslab.lab.oz.au (Andrew Phillips) writes:
>>ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes:
>>
>>: Suppose you want to generate integers in the range 0..N-1,
>>: with each integer being equally likely, and that you have
>>: a rand() function which delivers integers in the range 0..RANDMAX

>I believe you must discard the original random
>number if r/N >= RAND_MAX/N, then you can use r%N or r*N/(RAND_MAX+1).  
                                                      ^^^^^^^^^^^^^^^^
that ought to be  r*((unsigned long)N)/((RAND_MAX/N)*N)

                      - Jim Van Zandt <jrv@mbunix.mitre.org>
From: Mike.Pflugfelder@bbs.oit.unc.edu (Mike Pflugfelder)
Newsgroups: comp.lang.c
Subject: C book wanted
Date: 14 Aug 92 15:50:36 GMT
Organization: Extended Bulletin Board Service

I'm not sure if this is the right place to post this, but I'm looking for
a used Ansi C book, or something that will help me to learn C.  Right now,
I'm working on coding a game for the internet.  It's me and a friend of
mine, and I really need a C book to look at for the answers.  I'm also a
college student, and I don't have a lot of money.  I don't really care
what condition it would be in, as long as it has most of the pages.  Please
mail me as I don't look at this newsgroup at all.
Internet: ucpflugf@mcs.drexel.edu
	  Mike.Pflugfelder@bbs.oit.unc.edu

Mike		Sorry, no .sig here...

--
   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: fin@unet.umn.edu (Craig A. Finseth)
Subject: Re: why does #define Ctrl(c) c&037 work ?
Organization: University of Minnesota, Networking Services.
Distribution: worrrld
Date: Thu, 13 Aug 1992 13:39:59 GMT

In article <BRANNON.92Aug12164222@stun4r.cs.caltech.edu>, brannon@stun4r.cs.caltech.edu (Terrence M. Brannon) writes:
|> 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.

It works for 32 of the 33 control characters.  For example:

	A = 65 decimal = 101 octal

and

	101 & 37 = 1

which is ^A. In a similar fashion, it works for @, A-Z, [ \ ] ^ and _.
It fails for ? (as in ^?, 127 decimal).  The "correct" macro should
be:

#define Ctl(c) ((c)^'@')

Which works for all of the above, and ? too.

On the other hand, the GNU form picks up the lower case letters (as in
^a), but I at least would consider that usage to be silly, and
certainly not worth giving up ^? for.

Craig A. Finseth			fin@unet.umn.edu [CAF13]
Networking Services			+1 612 624 3375 desk
Computer and Information Services	+1 612 625 0006 problems
University of Minnesota			+1 612 626 1002 fax
130 Lind Hall, 207 Church St SE
Minneapolis MN 55455-0134, USA
Newsgroups: comp.lang.c
From: KSZ@VM.NRC.CA
Subject: Convert float to a string ?
Organization: National Research Council
Date: Wed, 19 Aug 92 16:08:44 EDT

Suppose I have a float a=12.4567, how can I convert it into a string including
8 characters? i.e. What I want is
                 char *b="12.34567";
One way may be writing the float into a temp file then load it as a string.
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 KAIJUN S. ZHAN                          || (613) 990 - 0734 (voice)
 Internet:ksz@vm.nrc.ca                  ||
 Internet:kzhan@sgi1.mathstat.uoguelph.ca|| "Three generates everything".
 Internet:gilwf16@vm.uoguelph.ca         ||
 Bitnet:ksz@nrcvm01                      ||      -- Lao Zhi
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: alpha@wyvern.twuug.com (Joe Wright)
Newsgroups: comp.lang.c
Subject: Re: Allocate memory to typed in string, How?
Date: 13 Aug 92 18:49:11 GMT
Organization: Box 68621, Virginia Beach, 23455
X-Newsreader: Tin 1.1 PL4

Attempts to allocate memory, char at a time, to an arbitrary 'string'
is silly even if it is possible.  If a string is assumed to be a line
of a text file or arbitrary keyboard input, we can easily declare that
it must not be longer than (let's say) 256 bytes.  Given that screens
are usually 80 to 132 chars wide, 256 will be wide enough for the
Ivory standard (99.44 % pure).  Having captured the line in our big
static buffer we can easily determine its length and allocate memory
and/or file space for the actual string.  If you don't like static 
strings, allocate 256 bytes, read the 'string' into it, find its length,
allocate that much (+1) and copy it.  Lots faster..

-- 
Joe Wright  alpha@wyvern.twuug.com
From: ark@alice.att.com (Andrew Koenig)
Newsgroups: comp.lang.c
Subject: Re: Pointer/address reluctance
Date: 23 Aug 92 03:55:52 GMT
Article-I.D.: alice.23530
Reply-To: ark@alice.UUCP ()
Distribution: na
Organization: AT&T Bell Laboratories, Murray Hill NJ

In article <10444.610.uupcb@spacebbs.com> ted.jensen@spacebbs.com (Ted Jensen) writes:

> Based on the above definitions (which I feel few could argue
> with), a pointer is an lvalue whereas an address is not.

... except that there are pointer-valued expressions that are not lvalues.
For example, if p is a variable of pointer type, p is obviously an
lvalue, but p+0 is not, even though p==p+0 by definition.
-- 
				--Andrew Koenig
				  ark@europa.att.com
Newsgroups: comp.lang.c