HDTenEightyP/NetNews huggingface dataset:
From: mccall@mksol.dseg.ti.com (fred j mccall 575-3539)
Subject: Re: Order of evaluation?
Organization: Texas Instruments Inc
Date: Fri, 6 Nov 1992 16:30:23 GMT

In <1dau8nINNk59@uranium.sto.pdb.sni.de> Josef Moellers <mollers.pad@sni.de> writes:

>In <1992Nov2.192805.17329@CSD-NewsHost.Stanford.EDU> amorgan@Xenon.Stanford.EDU (Crunchy Frog) writes:

>>In article <josef.720691377@uranium> Josef Moellers <mollers.pad@sni.de> writes:
>>>
>>>Furthermore, as "boolean" operations are nothing special in C, I wonder
>>>whether in
>>>	a() || b()
>>>b _should_ be called if a() returns TRUE.

>>It shouldn't be.  C has short circuit evaluation for && and ||.

>I'd like to clarify a mis-understanding.
>I _do_ know, how || and && work under C.

>The original thread was about whether a C-Compiler must arrange for
>first calling all functions and then evaluating the expressions.

>In my example, the original claim would mean that a() _and_ b() are
>called first, then the left side was (trivially) evaluated using the
>results of the call to a(), and if it was found to be TRUE, the result
>of the call to b() was dropped.

>My understanding was (and still is), that functions need only be called
>as far as necessary.

Quite true for boolean operators like || and &&.  Not only need they
only be called as far as necessary, they MUST only be called as far as
necessary. 

>E.g. in an expression like
>	a() * b() * c() * e() * f() * g()
>the compiler might decide to generate code to test the intermediate
>result to be 0, in which case the rest of the expression might be
>dropped.

I don't think this applies.  I believe the whole 'expression' must be
evaluated and the compiler is not allowed to short-circuit that.  If
the preceding were one expression of a '&&', it would have to be
evaluted completely (all functions called) even if the first
multiplication produced a zero.  In other words, side effects of the
functions must happen.

[I'm sure someone with a copy of the Standard handy will correct me if
I'm wrong.]

-- 
"Insisting on perfect safety is for people who don't have the balls to live
 in the real world."   -- Mary Shafer, NASA Ames Dryden
------------------------------------------------------------------------------
Fred.McCall@dseg.ti.com - I don't speak for others and they don't speak for me.
From: pjh@mccc.edu (P. J. Holsberg)
Newsgroups: comp.lang.c
Subject: Idle Questions about ANSI C
Date: 13 Nov 92 21:37:08 GMT
Organization: The College on the Other Side of U. S. 1

1) Is "size_t" ever not the same as "unsigned int"? If so, in what situation?

2) Is there ever a need for a static array defined inside a function in
ANSI C? I.e.,

int func(char c, int i)
{
	...
	static char name[30];
	...
}

Thanks,
Pete
Newsgroups: comp.lang.c
From: misar@rbg.informatik.th-darmstadt.de (walter misar)
Subject: Re: void pointer to a struct?
Date: Wed, 11 Nov 1992 08:37:32 GMT
Organization: TU Darmstadt

In article <1992Nov10.220944.1810@news.ysu.edu>, ae007@yfn.ysu.edu (Daniel Newcombe) writes:
> 
> Hi, I have a struct te { int i; char c}
> In the main part of the program I have the variable r declared
> as type te.  I also have j as type char.  I then have
> void *o   in there.  At first I have o point to j and do
> a printf("%c",*(char *)o) and this works.  How would I use
> o to point to r, and be able to print the c field?
> Thanks...
>  -Dan

Huch ???

printf("%c",((te *)(o=(void *)&r))->c);

should work, or a bit more readable:

o=(void *)&r;
printf("%c",((te *)o)->c);

Walter

Newsgroups: comp.lang.c
From: bandy@netnews.jhuapl.edu (Mike Bandy)
Subject: Re: time functions
Organization: JHU/Applied Physics Laboratory
Date: Sat, 7 Nov 1992 05:10:06 GMT

pkeddie@axion.bt.co.uk (Paul Keddie) writes:


>I'm trying to measure whether a rewritten function is more time
>efficient then the original. I have tried the functions defined
>in time.h but they only seem to measure time to the nearest
>second, which is far too big a unit of time for my purposes.
>(What should clock() return? it only seems to return 0 for me.)

>Is it possible to measure time more accurately than in seconds?
>The samller the unit of time the better!

You've forgotten to mention what operating system you're using.
If you can't tell if one of the new is faster than one of the old 
then how about 100 or 1,000?

-- 

	Mike Bandy
	bandy@aplcomm.jhuapl.edu
	Johns Hopkins University / Applied Physics Lab
From: 873clifton@gw.wmich.edu
Newsgroups: comp.lang.c
Subject: Source for pointer based heapsort?
Date: 6 Nov 92 16:51:40 EST
Organization: Western Michigan University

Hello fellow C programmers:

Not having any luck searching: archie, usenet comp.sources groups,
netlib, etc, I thought I might post a request for source hear. I
am trying to implent heap building and heapsort using a struct
pointer based method rather than the classic array based method.
I searched every book on data structures/algorithms I could lay
hands on as well as many programming periodicals, but all of them
used the array based method. My proposed structure would look 
something like this:

typedef struct _hnode	{
	int data;
	struct _hnode *rchild;	/* right child */
	struct _hnode *lchild;  /* left child */
	...
} hnode;

If some kind soul has solved this problem, could they please
Email me their source.

Thanks,

/Doug
--
Douglas Clifton [99clifto@lab.cc.wmich.edu]
From: fine@bimacs.BITNET (Linochka Fine)
Newsgroups: comp.lang.c
Subject: LEX and Borland C++ 3.1 incompatibility.
Date: 12 Nov 92 17:10:02 GMT
Organization: Math department, Bar-Ilan University, Ramat-Gan, ISRAEL


        Hi everybody !

  Since in my local host nobody was able to answer my question, I post it
here. I made my project using YACC and LEX for PC, and MSC 6.0. It worked
fine. But after some time I've decided to transfer it to Borland C Compiler,
since, unfortunately, most of PC C programmers prefer it (although I am sure,
that MicroSoft is best), and so it will be more easy to maintenance it by
the next generation of students...  After recompiling the sources I've got a
pile of warnings in the my "yylex.c" file, but I just didn't pay attention
to it, since MSC C also looked unhappy when it compiled it. But when I
tried to run the program, it produced something unreasonable... After some
debugging I've released that the problem is in the "yylex" function. I wrote
simple test in LEX, and it didn't work properly too. It seems, that the
problems are in the "yylook" subroutine, and they are caused from the
"Suspicious pointer conversion" warning. I.e., I think, that when it
tries to get values from the tables (offsets etc), it get them wrong. I even
tried to do some hacking on "ncform.c" LEX driver in order to fix it, but
unsuccessfully. (probably the code is too complicated for me).

  So, if anybody was faced with this problem, or even has alternative version
of LEX, please e-mail me. I use the fully undocumentated LEX and YACC,
and I even don't remember from where did I get them. The LEX seems to be
compiled by Microsoft compiler (the message "Microsoft Run-Time Library 1990"
in the code).

  Thank's in advance, hoping to receive responds,
        Mosha.


Newsgroups: comp.lang.c
From: asu@panther4.panther.mot.com (Russ Trotter)
Subject: Bad Joke
Organization: Motorola Panther Project, Chandler, AZ
Date: Fri, 6 Nov 1992 19:59:55 GMT

I heard a "joke" from my boss today...goes something like this,


With all of of President-elect Clinton's promises made, he'll have to
be extra careful of decisions and carefully scrutinize his 
actions..i.e.

		C-lint-on   


Get it........

But seriously folks.....


Russ
From: pendell@deneb.csustan.edu (Brian Pendell)
Newsgroups: comp.lang.c
Subject: pointers to functions
Summary: How do I call a function pointed to by a pointer?
Keywords: pointers functions parameters
Date: 6 Nov 92 23:47:29 GMT
Distribution: na
Organization: CSU Stanislaus

Greetings!

As many of you already know, the declaration

double (*pfun) ();

declares pfun to be a pointer to a function which returns double.

Now, how do I call the function using the pointer? That is, the next

instruction should be:

"Call the function pointed to by pfun with parameters A and B"

function (A,B), in other words.

Any suggestion?


	-- Brian Pendell (pendell@ceti.csustan.edu)
Newsgroups: comp.lang.c
From: carl@montebello.ecom.unimelb.EDU.AU (Carl Brewer)
Subject: Re:    using variables of type date in UNIX
Organization: Dept. Engineering Computer Resources, Melbourne Uni.
Date: Fri, 13 Nov 1992 10:23:52 GMT

In article <92314.235928U17868@uicvm.uic.edu> <U17868@uicvm.uic.edu> writes:
>I want to know how I can use the variable of type date in C. For example, how c
>ould I define a varaible like
>"todays_date" to be of type date and then read the input in the format like
>                       11/09/92
> I would be using ANSI C on UNIX. Is there any biult in function in C library t
>hat would allow me to declare a variable of type date . If the type date is a U
>NIX system command, how can I use it in my C program. Could I use it by definin
>g enumerated data type. If so, how?

#include <time.h>

suggest you read a manual ...



-- 
 Annal  Natrach, Usthvah Spethed,         carl@ecr.mu.oz.au (IRC: Bleve)
 Dochoel Dienve                           carl@munagin.ee.mu.oz.au
					  carl@montebello.ecom.unimelb.EDU.AU
 Merlin, where are you?  Call your dragon, to weave a mist...
Newsgroups: comp.lang.c
From: hpv@kelvin.uio.no (Hans Peter Verne)
Subject: Re: TC 2.0: unable to open include files
Organization: University of Oslo, Norway
Date: Tue, 10 Nov 1992 10:46:02 GMT


In article <1992Nov9.230652.26156@sctc.com> glanton@sctc.com (John Glanton) writes:

>   Has anyone run into this error.  I only get it with nested includes
>   in \tc\include.  The files exist and are where one would expect them
>   to be but TC can't open them.  For example, when including stdio.h
>   I get this error when TC tries to open stdarg.h.
>
>   Thanks in advance

You may run out of file handles. Try adding some in your config.sys-file
(FILES = __ ) 

hugs,
Hans Peter
Newsgroups: comp.lang.c
From: steve@taumet.com (Steve Clamage)
Subject: Re: LHS Casting
Organization: TauMetric Corporation
Date: Fri, 13 Nov 1992 17:24:52 GMT

darcy@druid.uucp (D'Arcy J.M. Cain) writes:

>(int *) charptr = intptr + (OFFSET/2);

>Well of course this is bad.  The FAQ (question 2.13) shows another case
>where the wrong code has the cast on the left hand side of an assignment.
>Is it safe to say that there is never any case where a cast belongs on
>the LHS of an assignment?  It seems to me that at best such code is
>clumsy and could be better written some other way and that probably
>it is wrong and the compiler is always free to reject such constructs.

It is stated clearly in K&R1 (1978) that a cast is a conversion which
produces a value, not an lvalue, and therefore cannot appear as the
expression on the left side of an assignment.  This is repeated in
the C Standard.

Some C compilers did not object to some kinds of lhs casts, and some
programmers got used to being able to write code like the above.
A Standard-conforming compiler should reject it.

There is a correct way to achieve the effect:  take the address,
cast to a pointer to the desired type, and store through that pointer.
This is as safe and as portable as casts can be.  That is, it will
work if the machine supports the kind of cast being asked for.  The
above example should be written

	*((int **) &charptr) = intptr + (OFFSET/2);
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
Vice Chair, ANSI C++ Committee, X3J16
Newsgroups: comp.lang.c
From: conor@lion.inmos.co.uk (Conor O'Neill)
Subject: Re: To Recurse or NOT to recurse?
Reply-To: conor@inmos.co.uk (Conor O'Neill)
Organization: INMOS Limited, Bristol, UK.
Date: Thu, 12 Nov 1992 15:55:09 GMT

In article <BxKAJ2.7H@netnews.jhuapl.edu> bandy@netnews.jhuapl.edu (Mike Bandy) writes:
>I've used C on a few platforms and have never seen an optimization that
>converts recursion to anything but an optimized recursion.  What you're 
>saying is that the optimizer will replace user-defined function calls
>with in-line code.  Can someone give an example of a compiler (and perhaps 
>some code) that verifies this?

The INMOS optimising ANSI C compiler produces essentially identical code
for the following two examples; it happily optimises the tail recursion.

#include <stdlib.h>
typedef int data;
typedef struct tree_s
  {
    data *d;
    struct tree_s *left;
    struct tree_s *right;
  } tree_t;

/* recursive function */

tree_t *find(tree_t *t, data *d) {
        if (t == NULL)                          /* sentinel */
                return NULL;
        else if (t->d == d)                     /* node found? */
                return t;
        else if (t->d > d)                      /* search left */
                return find(t->left, d);
        else                                    /* search right */
                return find(t->right, d);
}

/* non-recursive function */

tree_t *find(tree_t *t, data *d) {
        while (t != NULL)
                if (t->d == d)                  /* node found? */
                        return t;
                else if (t->d > d)              /* search left */
                        t= t->left;
                else                            /* search right */
                        t= t->right;
        return NULL;                            /* sentinel */
}

---
Conor O'Neill, Software Group, INMOS Ltd., UK.
UK: conor@inmos.co.uk		US: conor@inmos.com
"It's state-of-the-art" "But it doesn't work!" "That is the state-of-the-art".
From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius)
Newsgroups: comp.lang.c
Subject: Re: Hows this for odd
Date: 11 Nov 92 00:28:52 GMT
Organization: University of Helsinki

In a recent article I wrote:
> since an equality test does not yield a conceptually boolean value

which should have been "conceptually arithmetic value", of course.

Also, it was pointed to me by e-mail that the original poster was
complaining about was using a function call to compare against an
empty string.  While I agree that this does seem wasteful (I compare
the first char to '\0' myself as well), it does have the advantage of
being more orthogonal, since you do string comparisons always in the
same way.  A bit like most people seem to always use printf to print
to stderr, instead of putchar, puts, or some other function, which
would seem to be more efficient.  (There are no guarantees that they
will be more efficient in practice that the added confusion of several
output functions is worth it.  This too is a stylistic issue,
however.)

--
Lars.Wirzenius@helsinki.fi  (finger wirzeniu@klaava.helsinki.fi)
   MS-DOS, you can't live with it, you can live without it.
Newsgroups: comp.lang.c
From: jmwojtal@vela.acs.oakland.edu (Wojo)
Subject: Stack overflow problems
Organization: Oakland University, Rochester MI.
Date: Mon, 9 Nov 1992 15:35:26 GMT

First of all, thank you for your responses about double arrays.  Now I have
another problem, I'm storing too much data in my program.

I identified the main culprits:

struct key {
  char *word;
  char pos;
} keytab[] = {
     "0101", 1,
      .....
     "1302", 33};

struct today {
  char count;
  char maxt;
} timenow[33][31];

char timetab[33][24];

the 33 is the number of keytabs (I use a constant NKEYS in my program)
the 31 is the maximum number of days in a month
the 24 is the hours in a day;

The program reads in files for a given month.  All files have one day of
information about information about "0101" thru "1302".  There are between
1 to 15 lines of information an hour.

I believe I have a logrithm to do it, but when I run it, garbage comes out of
it, with different values of keytab even though I don't change them.  

Is there any way to eliminate the space problem without doing any major changes
to the program?

Thank You


-- 
************************************************************************
Jeff Wojtalewicz (Wojo)  jmwojtal@vela.acs.oakland.edu
Oakland University		      Start Hacking
************************************************************************
Newsgroups: comp.lang.c
From: root@fincomp.raidernet.com (Neal McClain)
Subject: Re: New Ph.D. Program
Organization: Financial Computers Corp., Murfreesboro, TN
Date: Wed, 11 Nov 1992 15:00:24 GMT

In <1992Nov9.200217.19269@ils.nwu.edu> jones@ils.nwu.edu writes:

>T h e   L  E  A  R  N  I  N  G    S  C  I  E  N  C  E  S    P h. D.   P r o g r
>a m

<<< many long and fancy words deleted >>>

I'm not quite sure what this announcement has to do with C unless the prof
thinks that C programmers are good at piling things higher and deeper
already and are thereby good candidates for a PHD.


Neal McClain               | Beam me up Scottie, there's no intelligent 
Murfreesboro, Tn           | life down here!   
root@fincomp.raidernet.com | uunet!mjbtn!fincomp!root
Newsgroups: comp.lang.c
From: singh@qucis.queensu.ca (Pawan Singh)
Subject: Wanted some C programs using pointers
Keywords: Pointers
Organization: Computing & Information Science, Queen's University
Date: Wed, 11 Nov 1992 22:22:18 GMT

I needed some complex C programs using lots of pointers for
doing pointer dependence analysis.
The programs should have following characterstics:

1. It should not be interactive i.e. should not wait for input.
2. It should be in one file.

Please do not send standard bench mark programs because they
are already available.

If you happen to know an ftp site for this, please send the
address.

Thanks in advance,
Pawan Singh
_________________________________________________________________________

Pawan K. Singh			email: singh@qucis.queensu.ca
485A Alfred St.
Kingston, Ontario		PAWAN K. SINGH
K7K 4J4, Canada.	

Phone: 613-542-7802
_________________________________________________________________________     
-- 
_________________________________________________________________________

Pawan K. Singh			email: singh@qucis.queensu.ca
485A Alfred St.
Newsgroups: comp.lang.c
From: bena@yoyo.cc.monash.edu.au (Ben Aveling)
Subject: Re: Macros
Organization: Monash University General Access Unix
X-Newsreader: TIN [version 1.1 PL6]
Date: Tue, 10 Nov 1992 00:34:12 GMT

William C. Thompson (wct@po.CWRU.Edu) wrote:

:   if (((A)=(double **)malloc(sizeof(double *)*(rows)))==NULL)
:     printf("Allocation error!\n");
:   for (i=0; i<(cols); i++)
                 ^^^^
:     if (((A)[i]=(double *)malloc(sizeof(double)*(cols)))==NULL)

Shouldn't that be rows ?
	
	Ben	:-)
From: hartman@ulogic.UUCP (Richard M. Hartman)
Newsgroups: comp.lang.c
Subject: Re: Productivity of a C programmer ?
Date: 11 Nov 92 21:22:12 GMT
Organization: negligable

I agree.  I want more of a balance, than a massive amount of comments.
I'm not sure I handle inline (// to end of line) comments properly either,
since they are a recent addition.  A line w/ one of those counts as (pick one):

	a) code
	b) comment
	c) both
	d) neither (new category required)

However, since I'm not likely to hook up a grammer checker and prose
complexity analyser to determine whether the comments have been written
at 7th grade or 3rd grade level, I do the best I can with what I can.
(It's even harder to automate checking to see if the comment actually
pertains to the code...)

		-Richard Hartman
		hartman@ulogic.COM

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Never speak in absolutes.  It will always lead to trouble.
Newsgroups: comp.lang.c
Subject: Telecommuters, Remote Workers
From: 9138827a@levels.unisa.edu.au
Date: 2 Nov 92 17:30:36 +1030
Organization: University of South Australia

This item has been cross-posted to comp.object
=========================================================

I am undertaking postgraduate study at the School of Library and
Information Management, University of South Australia, Adelaide, on
the particular information needs of telecommuters - those who perform
job-related work at a site away from an organisation and communicate
electronically rather than commuting physically.
 
I would be very interested in, and would greatly appreciate a response
from those who are telecommuters, to the following questions. If you
are not a telecommuter but know of others who are it would be
appreciated if you could pass this on to them:
 
 
Q1      Does the organisation to which you telecommute provide any
        library and information services which are accessible to you
        online? (eg catalogs, reference assistance, databases, literature
        searches, document delivery services, organisation information
        such as daily bulletins and administrative gazettes.)
 
        If yes:
 
        (a) What services are provided?
        (b) How useful are these services to you?
 
Q2      (a)     What is the nature of the organisation to which you
                telecommute?
 
        (b)     If you sometimes commute physically to your organisation,
                how frequently do you do this?
 
Q3      What are the particular information needs that you have as a
        telecommuter?
 
Q4      What basic information services do you consider should be
        provided by an organisation for its telecommuters? (see Q5 for
        additional and desirable services)
 
Q5      What additional information services would you perceive as being
        highly desirable for an organisation to provide for its
        telecommuters?
 
Q6      Are there any further comments you wish to make regarding the
        information needs of telecommuters?
 
Q7      Would you like a summary of the results of this survey E-mailed
        to you?
 
Respondents can be assured that individuals and organisations will not
be identified in any report or summary of this survey.
 
Please E-mail your response to my Internet address:
 
9138827a@ntx.city.unisa.edu.au
 
Thank you for your cooperation
 
Bronwen Strong
From: torek@horse.ee.lbl.gov (Chris Torek)
Newsgroups: comp.lang.c
Subject: Re: How to print an integer as binary?
Date: 8 Nov 1992 12:29:27 GMT
Organization: Lawrence Berkeley Laboratory, Berkeley
Reply-To: torek@horse.ee.lbl.gov (Chris Torek)
NNTP-Posting-Host: 128.3.112.15

In article <27265@dog.ee.lbl.gov> I included an `ltostr' function
that acts as the counterpart to `strtol'.  In it I had:

>	static const char digits[] = "0123456789abcdefghijklmnopqrstuvwyxz";

Surprisingly, no one has yet sent me mail noting that y and x are
interchanged here.  I guess not many people use bases > 33. :-)
-- 
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 510 486 5427)
Berkeley, CA		Domain:	torek@ee.lbl.gov
From: throopw@sheol.UUCP (Wayne Throop)
Newsgroups: comp.lang.c
Subject: Re: & of array - what does ANSI specify for resulting value?
Summary: what you mean "value", kemosabe?
Date: 13 Nov 92 01:08:50 GMT

: From: engber@ils.nwu.edu (Mike Engber)
: Message-ID: <1992Nov12.174305.1901@ils.nwu.edu>
:              int foo[3];
: I know ANSI specifies the type of &foo will be an int**, how about
: the value? Is it unspecified - or - &foo[0].

Hmmmm.  As Will Rogers said, "It ain't what you don't know
that'll git ya... it's all them things you know that ain't so!".

The type of &foo is NOT (I repeat NOT NOT NOT) (int**).
It is (int (*)[10]).  (In K&R, it used to be of type (int*).)
You can tell the difference by (eg)

       printf( "%d %d\n", sizeof *&foo, sizeof *(int**)&foo );

As to the value... well, it's probably a good bet that 
((void*)&foo) and ((void*)&foo[0]) will compare equal.  Though
I doubt that the standard claims that it must do so (what with
its rigidly defined areas of uncertainty and doubt, and all).
--
Wayne Throop  ...!mcnc!dg-rtp!sheol!throopw
From: burch@rhps.chi.il.us (Lee Burch)
Newsgroups: comp.lang.c
Subject: Re: Bplus11 B-tree library
Keywords: b-tree bplus turboc
Date: Sun, 08 Nov 92 15:22:54 CST
Organization: CrissySoft Incorporated

icsg0131@cs.montana.edu (Jeff) writes:

> 
> Hello.  
> 
> I have used the bplus package (v10 and v11) on a variety of compilers
> and never had a problem.
>
> -- 
> Jeff              icsg0131%caesar@cs.montana.edu

  is the b-tree package you are refering to public domain or
shareware? if so whre might I obtain a copy and under what name?

-- Lee Burch