HDTenEightyP/NetNews huggingface dataset:
Newsgroups: comp.lang.c

In comp.lang.c, rons@hardy.u.washington.edu (Ronald Schoenberg) writes:

> In article <gay.721614205@sfu.ca> gay@selkirk.sfu.ca (Ian D. Gay) writes:
> >rons@hardy.u.washington.edu (Ronald Schoenberg) writes:
> >
> >>  Fortran arrays are column echelon for a
> >>reason, and C arrays are row echelon slowing down matrix operations
> >>relative to Fortran.     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >
> >Maybe I'm missing something, but I don't see why this should be so. 
> >Could you explain more fully?
> >
> >
> >>Ron Schoenberg

> The most important matrix operation in numerical work is the gaxpy
> ("generalized a times x plus y").  Numerical routines are written to
> be rich in gaxpies (see Matrix Computations by Golub and Van Loan for
> details). In the source code below I have written two gaxpies, one
> for data stored column echelon and a second for the same data stored
> row echelon.  The only difference between the two is in the
> calculation of the index of the element of the two dimensional array
> used in the multiplication.  You will note that the index in the
> column echelon storage is a simple increment, whereas in the row
> echelon storage two operations in addition to the assignment are 
> required.  I know very little about assembly code, but I believe that an
> assembly version of the column echelon gaxpy is especially efficient,
> while the assembly code for row echelon would involve a number of extra
> operations.

A simple rearrangment of the row echelon calculation is shown below. This
seems to show that there is no difference! Or am I missing something?

> #include <stdio.h>

> void main()
> {
>     float a_col[] = { 1,5,9,13,2,6,10,14,3,7,11,15,4,8,12,16 };
>     float a_row[] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 };
>     float x[] = { 1,2,3,4 };
>     float z[4];

>     int m = 4, n = 4;
>     int i, j, k;

> /*
> ** column echelon gaxpy
> */
>     for (i = 0; i < m; i++) {
>         z[i] = 0;
>         k = i;
>         for (j = 0; j < n; j++) {
>             z[i] += a_col[k] * x[j];
>             k += n;
>         }
>     }

> /*
> ** row echelon gaxpy
> */
>     for (i = 0; i < m; i++) {  
>         z[i] = 0;
>         for (j = 0; j < n; j++) {
>             k = i * n + j;
>             z[i] += a_row[k] * x[j];
>         }
>     }

 /***** Redo the above row echelon gaxpy: *****/

      k = 0;
      for (i = 0; i < m; i++) {  
          z[i] = 0;
          /***** k will be n*i on entry to loop *****/
          for (j = 0; j < n; j++) {
              /***** k will be n*i + j on each pass thru loop *****/
              z[i] += a_row[k] * x[j];
              k++;
          }
      }

> }


If anything, the code will be faster for the modfied row echelon calculation.

Larry Gajdos
Newsgroups: comp.lang.c
From: neelesh@happy.eng.wayne.edu (Neelesh Rangnekar)
Subject: graphical user interfaces
Organization: Wayne State University, Detroit
Date: Mon, 23 Nov 1992 13:50:31 GMT

HI ! EVERYBODY ,
I am looking for a graphical user interface in C . Some routines that will help
me to develop either some things like pop up or pull down menus. 
Will some kind soul help me out.
Please mail me either the book name or some routines . 
Thanks in advance.

Neelesh
From: mouse@thunder.mcrcim.mcgill.edu (der Mouse)
Newsgroups: comp.lang.c
Subject: Re: What is meant by: double A[n,m]?
Date: 20 Nov 92 10:24:16 GMT
Organization: McGill Research Centre for Intelligent Machines

In article <1992Nov18.223900.8941@kpc.com>, hollasch@kpc.com (Steve Hollasch) writes:
> torstein@itekiris.kjemi.unit.no (torstein hansen) writes:
>> double A[n,m];
> jlothian@castle.ed.ac.uk (J Lothian) writes:
>> I suspect that's exactly what's happening.  The comma operator
>> [...].  Presumably your C compiler is quite happy to do this
>> evaluation at compile-time, [...].
> Not true.  First of all, the expression "A[index]" is not evaluated
> at compile time,

In the original posting, it wasn't an expression, and the stuff in the
[] was necessarily evaluated at compile-time because it was an array
size in a declaration.

As for meaningless, it's not meaningless, no.  But the comma operator
is not one of the operators allowed in compile-time constant
expressions such as must be used to specify array sizes, so it's not
really a legal declaration, though apparently at least one compiler
accepts it anyway.

					der Mouse

			    mouse@larry.mcrcim.mcgill.edu
Newsgroups: comp.lang.c,comp.lang.c++
From: sl14@crux3.cit.cornell.edu (Stephen Lee)
Subject: Write in C
Organization: Fantasy Zone Ithaca, Inc.
Date: Mon, 16 Nov 92 01:23:13 GMT

I found this one in another newsgroup.  If you haven't see it,
enjoy...

From: c60b-3gj@web-4a.berkeley.edu (Leo Wong)
Newsgroups: soc.culture.hongkong
Subject: Write in C
Date: 11 Nov 1992 00:59:40 GMT
Organization: University of California, Berkeley
Distribution: world
NNTP-Posting-Host: web-4a.berkeley.edu

If you are a beginning C programmer, a die-hard C language fan, or someone
who have heard the language.  The following song should put a smile on your 
face.  (Sung cheerfully to the tune of the famous Beatles song:  Let it be)

  When I find my code in tons of trouble,
  Friends and colleages come to me,
  Speaking words of wisdom:
  "Write in C."

  As the deadline fast approaches,
  And bugs are all that I can see,
  Somewhere, someone whispers:
  "Write in C."

  Write in C, write in C,
  Write in C, oh, write in C.
  LOGO's dead and buried,
  Write in C.

  I used to write a lot of FORTRAN,
  For science it worked flawlessly.
  Try using it for graphics!
  Write in C.

  If you've just spent nearly 30 hours
  Debugging some assembly,
  Soon you will be glad to
  Write in C.

  Write in C, write in C,
  Write in C, yeah, write in C.
  Only wimps use BASIC.
  Write in C.

  Write in C, write in C
  Write in C, oh, write in C.
  Pascal won't quite cut it.
  Write in C.

  Write in C, write in C,
  Write in C, yeah, write in C.
  Don't even mention COBOL.
  Write in C.



--
Stephen Lee
Internet: sl14@crux2.cit.cornell.edu
Xref: sparky comp.lang.c:16716 comp.lang.c++:16498
From: warlok@rhps.chi.il.us (Jon L Fincher)
Newsgroups: comp.lang.c,comp.lang.c++
Subject: Re: Converting an int or a float into a string*???
Date: Mon, 16 Nov 92 19:32:57 CST
Organization: CrissySoft Incorporated

yhtao@magnus.acs.ohio-state.edu (Yu-Hui Tao) writes:

>    I have an array of numerical numbers of type either int or float. 
> What I want is to convert this array into of type char*. For example, 
> converting num[0]=1.02 into num[0]="1.02".   
> 
>    How do I do this in C and C++? Hope this is not too trival!

You could try to standard C function fcvt(), which tranlates a float to
a string.  Cast your ints to doubles, then call fcvt(), syntax:

  char *fcvt( double val, int ndig, int * dec, int *sign);

val - the number to convert.
ndig - length of string to contain translation.
dec - pointer to a position in the string where the decimal
      point goes.
sign - points to non-zero value if val is negative, 0 otherwise.

The return value is static data, so strcpy() it before you call fcvt()
again.  Note that dec and sign are returned values - there is no
decimal point in the string and no sign value.  You can construct a
signed, pointed number using strcat() and strcpy() just after you call fcvt().

Hope you can handle that yourself....

J.L.Fincher,  Warlok

Xref: sparky comp.lang.c:16631 comp.software-eng:4335
From: flint@gistdev.gist.com (Flint Pellett)
Newsgroups: comp.lang.c,comp.software-eng
Subject: Re: Will we keep ignoring this productivity issue?
Date: 16 Nov 92 20:19:57 GMT
Followup-To: comp.lang.c
Organization: Global Information Systems Technology Inc., Savoy, IL

rcd@raven.eklektix.com (Dick Dunn) writes:

>....  On the
>other hand, we seem to think we've got enough good programmers that we can
>afford to spend them cleaning up code of a sort they'd never write in their
>worst drunken stupors.

>Well, I'm no Van Jacobson, but I've certainly had to spend extended periods
>working on code of a quality for which I would have flunked my first-semester
>programming students 15 years ago.

This looks to me like an area that someone ought to devote some study to:
it would be interesting, at the very least, to get some feel for what
percentage of their time top programmers spend cleaning up after the
others, (or in consulting/teaching others) and then formulate some
methodologies for eliminating THAT problem.  If the top people are
spending half their time cleaning up junk, you have a potential doubling
of productivity right there.  (While it is less of a problem in these
days when it is cheaper to buy a new disk than clean out an old one,
it used to be the case that a lot of time was expended in going thru
disk and deleting worthless junk.  It was often the most valued
people who had to do that, because they were the only ones who had
the judgement and knowledge necessary to be able to sort the good
stuff you needed to save out from the garbage.)

One example of the "cleaning up junk" area: I've noted that one thing
the poorer programmers like to do when they need to do something that
is very similar to what an existing routine is doing is to make another
whole copy of the original routine, then tweak it slightly.  You end
up with 2.0 times as much code to provide 1.05 times as much function,
and often when the good programmer comes back to it they have to spend
a lot of time before they notice the duplicated code and can cut it
down to size.
-- 
Flint Pellett, Global Information Systems Technology, Inc.
100 Trade Centre Drive, Suite 301, Champaign, IL  61820     (217) 352-1165
uunet!gistdev!flint or flint@gistdev.gist.com
From: ah739@cleveland.Freenet.Edu (Leslie J. Somos)
Newsgroups: comp.lang.c
Subject: Re: Date Manipulation
Date: 17 Nov 1992 17:13:26 GMT
Organization: Case Western Reserve University, Cleveland, OH (USA)
Reply-To: ah739@cleveland.Freenet.Edu (Leslie J. Somos)
NNTP-Posting-Host: slc4.ins.cwru.edu


In a previous article, c23dew@kocrsv01.delcoelect.com (David White) says:

>Can anyone suggest texts, etc. that would point me to any methods
>on date manipulation; Specifically, I am interested in the best
>way to display,print,store, and calculate dates (year, month and
>day resolution).
>
>
>-- 
>David E. White				Domain:	c23dew@kocrsv01.delcoelect.com
>Advanced Project Engineer		UUCP:	deaes!c23dew 
>Delco Electronics Corporation		
>GM Hughes Electronics		        Tel: ATT 317-451-0663  GM 8-322-0663	
>

"Calendrical Calculations" by Nachum Dershowitz and Edward M. Reingold
in _Software--Practice and Experience_, Vol.20(9), 899-928 (September 1990).

Summary:   A unified, algorithmic presentations is given for the Gregorian
(current civil), ISO, Julian (old civil), Islamic (Moslem), and Hebrew 
(Jewish) calendars.  Easy conversion among these calendars is a byproduct
of the approach, as is the determination of secular and religious holidays.

(C) 1990 by John Wiley & Sons, Ltd.    
Chichester-New York-Brisbane-Toronto-Singapore
ISSN 0038-0644
From: steven.roberts@odybbs.gvl.oh.us (Steven Roberts) 
Newsgroups: comp.lang.c
Subject: TLINK ERROR
Date: 18 Nov 92 22:00:00 GMT
Distribution: world
Organization: The Odyssey BBS - Garrettsville, OH - 216-527-2186
Reply-To: steven.roberts@odybbs.gvl.oh.us (Steven Roberts) 

Hello.
I've just started using Turbo C++ and typed in one of my first programs.
 The program includes "stream.h" which handles all the cin and cout
commands.   The problem I'm having come when this program complies.  It
lists a TLink error that says that the symbol istream::get_long(int) is
not defined in Project.cpp (my programs name.)  I never use the get_long
function, which is defined as private to the stream.h file, so I have no
idea what is going on.  All the function calls to this header should be
standard, and therefore, I haven't defined any of them in my program.
If I need to could someone point out how I might do this.  Any help
would be appreciated greatly.  Thanks in advance.
Steven Roberts
                                                       
Xref: sparky comp.lang.c:17021 comp.software-eng:4459
From: mcgregor@netcom.com (Scott Mcgregor)
Newsgroups: comp.lang.c,comp.software-eng
Subject: Re: Wanted: Supported equivalent of FileMerge
Date: 23 Nov 92 08:45:09 GMT
Organization: Netcom - Online Communication Services (408 241-9760 guest)

In article <bklkgg-S@twinsun.com> eggert@twinsun.com (Paul Eggert) writes:

>GNU diff has also seen some improvements since McGregor's old study,
>particularly in the area of merging.  I wonder what the results would
>be like if the study were performed again today?

The last test we did against GNUdiff (and Gnuemacs) was earlier this
year. That's the one I reported here, not an older study.
Nevertheless, I am always game to work with any other group that would
like to do an independent test.  Volunteers are welcome. Tests against
Sun's merge-tool and DEC's dxdiff are welcome too.

GNUdiff is very good about certain things, but more limited with
respect to how it deals with the cognitive limitations of its users.
The errors that we found in the GNUdiff tests were pilot errors and delays
in areas where we had expected cognitive overload (losing one's place,
confusion, etc.) to occur. GNUdiff continues to be improved, and
indeed we support use of it as an underlying engine for computing
diffs (but not displaying and reconciling them). However the 
improvements to GNUdiff are primarily new features and options and not
significant enough  enhancements to the user interface needed for better task
performance. One reason for this is that GNUdiff is designed to support
ASCII terminals and therefore can't take advantage of some of the
design freedoms that X displays allow, and which Merge Ahead uses to
actively reduce cognitive load on the user that reduces task
performance.

Other than this limitation (which to be fair, wasn't GNUdiff's primary
goal), I think GNUdiff is quite good, and makes a great diff engine.
But for people that want a car rather than their hands directly on the
engine, some of the alternatives are worth a look.



-- 

Scott L. McGregor		mcgregor@netcom.com
President			tel: 408-985-1824
Prescient Software, Inc.	fax: 408-985-1936
3494 Yuba Avenue
San Jose, CA 95117-2967
From: richard@crowded-house.den.mmc.com (Richard Armstrong)
Subject: Re: Where are literals stored?
Organization: Martin Marietta
Date: Thu, 19 Nov 1992 18:57:12 GMT

In article <1992Nov18.233739.2335@den.mmc.com> richard@crowded-house.den.mmc.com (Richard Armstrong) writes:
>Are literals always stored in the same location in memory? (IBM-PC,Borland)
>
>For instance, is the string a stored in the same place in the following
>two declarations?:
>
>static char *a[]="ABC"
>funca()
>{
>}
>
>funca()
>{
>char *a[]="ABC";
>}
>

The lack of response on this issue has prompted me to supply more information.

We have an application that is running out of heap and stack space.  We are
trying to figure out if the above declarations store the literal strings in
the same place, and if that is the case, we will not bother changing the way
we declare these strings.  If anyone has any suggestions on moving memory
around so that heap and stack are not compromised, then please let me know.

The current environment is Borland C++ on PC's.  We can also use Microsoft C++
7.0.

Thanks in advance.



-- 
My company never said any of this... I didn't either.
Richard Armstrong, Software Engineer, Martin Marietta
Email->>>> richard@crowded-house.den.mmc.com <<<<-Email
From: scjones@thor.sdrc.com (Larry Jones)
Newsgroups: comp.lang.c
Subject: Re: pointers to functions
Keywords: pointers functions parameters
Date: 22 Nov 92 17:24:02 GMT
Distribution: na

In article <1992Nov22.000843.191255@zeus.calpoly.edu>, tcobbs@zeus.calpoly.edu (Travis Cobbs) writes:
> [about how to call a function through a pointer]
> Actually, you don't need to use (*pfun)(), you can just use pfun().  C
> interprets them both the same way, since there's no other logical thing to do
> with a function call except call the function.

That's true for ANSI compilers, but some non-ANSI compilers insist on the
first form.  And many of us prefer that from a stylistic viewpoint since
it emphasizes that pfun is pointing to the function being called rather
than the actual name of the function.
----
Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH  45150-2789  513-576-2070
larry.jones@sdrc.com  or  ...uunet!sdrc!larry.jones
Everything's gotta have rules, rules, rules! -- Calvin
Newsgroups: comp.lang.c
From: nahaym@chdasic.sps.mot.com (Michael Nahay)
Subject: Help with 'make' files.
Keywords: make
Organization: Motorola 
Date: Mon, 23 Nov 1992 20:28:39 GMT

Hi,

I trying to use the 'make' utility to compile and link
my programs.  The problem is, I can't seem to get it to
work properly.  I have a program that is split into two
files: main.c and misc.c.  Here's what I tried:
-------------------------------------------------------
all: main
main:	main.o misc.o
	cc main.o misc.o -o main
misc.o : misc.c
	cc -o misc misc.c
main.o : main.c
	cc -o main main.c 
-------------------------------------------------------
I then type 'make', but it never links the main
and misc together....

Any ideas? (i'm using hpux 8.07 on an HP730)

-- 
Michael Nahay	Motorola SPS ASIC   		nahaym@chdasic.sps.mot.com
   		1300 N. Alma School Rd
   	 	M/S CH275			office:  (602) 821-4261
   	  	Chandler, Arizona 85224	 	home:    (602) 491-6401
From: amn@unix.brighton.ac.uk (Anthony Naggs)
Newsgroups: comp.lang.c
Subject: Re: Multiple &'s in an if statement
Keywords: &
Date: 24 Nov 92 01:26:39 GMT
Reply-To: amn@vms.brighton.ac.uk
Distribution: comp.lang.c
Organization: University of Brighton, UK

In article <1992Nov23.164530.19214@iacd> bcochell@ips.iacd.honeywell.com writes:
>Greetings,
>
>Can anyone explain why this works correctly (That is, it checks to see that
>the last 5 characters of name are all digits and that it is null terminated):
>
>   if ( isdigit(name[strlen(path)]) &
>        isdigit(name[(strlen(path) + 1)]) &
>        isdigit(name[(strlen(path) + 2)]) &
>        isdigit(name[(strlen(path) + 3)]) &
>        isdigit(name[(strlen(path) + 4)]) )
>      if ( iscntrl(name[(strlen(path) + 5)]) ) {
>         printf("%s\n",name);
>      }

isdigit (which is a macro by the way) will return a value, say 4.

Now 4 & 4 & 4 & 4 & 4 is equal to 4.

iscntrl will return a different value, say 2.

>While the following does not?:
>
>   if ( isdigit(name[strlen(path)]) &
>        isdigit(name[(strlen(path) + 1)]) &
>        isdigit(name[(strlen(path) + 2)]) &
>        isdigit(name[(strlen(path) + 3)]) &
>        isdigit(name[(strlen(path) + 4)]) &
>        (name[(strlen(path) + 5)] == NULL ) ) {
>      printf("%s\n",name);
>   }
>
>Why do I have to check for NULL with a separate if statement?

Because you should be using '&&' which ANDs tests together, rather than 
'&' which ANDs the binary bits.

The result of (name[..] == NULL) will be either 1 or 0.  If you bitwise
AND either with 2 you get 0!

>Any opinions will be appreciated

Sure?  Okay, try reading a beginners guide to C, or going on a training
course.  Learn the language, please, before you do real work with it.

Regards,
Anthony Naggs
Software/Electronics Engineer                   P O Box 1080, Peacehaven
                                                East Sussex  BN10 8PZ
Phone: +44 273 589701                           Great Britain
Email: (c/o Univ of Brighton) amn@vms.brighton.ac.uk  or  xa329@city.ac.uk
From: throopw@sheol.UUCP (Wayne Throop)
Newsgroups: comp.lang.c
Subject: 2-D Arrays
Date: 24 Nov 92 00:32:53 GMT

: From: 2hujwant@kuhub.cc.ukans.edu
: Message-ID: <1992Nov23.010230.45040@kuhub.cc.ukans.edu>
:  our teacher told us that you define them [..2-d arrays..]
: just like any other array, but with another index.  i.e.:
:           char some_array_name [dim1] [dim2]
: BUT, he said, if [...] we want a two-dimensional array that
: we can pass around to/from functions (and what good is an array that
: you couldn't?) we should define it thusly:
:     typedef struct { char text[dim1][dim2]; } 2-d_arraytype;
:     2-d_arraytype TheArray;
: And from there access it as:
:     TheArray.text[row][col]
: Or pass it to a function as:
:     void some_func (2-d_arraytype *a_pointer)
: And, of course, from there access it as:
:     *a_pointer->text[row][col] = some_character;
: My real question is, then, Is this the "correct" way to manipulate
: 2-d arrays, or is there a better way.

Get a new teacher.  Seriously.  Waste no more time with this one.

It is true that if you wish to pass arrays *by*value*, you must
enclose them in a structure, because of the behavior of objects
of array types in value contexts.  But the example listed above
is much better handled by

        void f(int formal_array[N][M]){
            ... formal_array[i][j] ...
        }
        void g(void){
            int actual_array[N][M];
            ... f(actual_array); ...
        }

It is also true that if you wish to pass *adaptive* arrays in C,
you either have to simulate multiple dimensional addressing, or
use nonstandard extensions available in some compilers such as gcc.

Finally, the expression (*a_pointer->text[row][col]) above is
ill considered: it won't even compile as given.  It has too
many indirection operations.  The three C compilers I have here
just now have this to say about it (when placed in a compilable
context:

        1st compiler:   illegal indirection
        2nd compiler:   invalid type argument of `unary *'
        3rd compiler:   "a_pointer->text[1][1]" has a char type, but
                        occurs in a context that requires a pointer

( Well... the string "2-d_array_type" isn't a valid identifier in C...
  I also substituted "two_d_array_type" as appropriate... )
--
Wayne Throop  ...!mcnc!dg-rtp!sheol!throopw
Newsgroups: comp.lang.c
From: tada@athena.mit.edu (Michael J Zehr)
Subject: Re: Can you program in C?
Organization: Massachusetts Institute of Technology
Date: Tue, 17 Nov 1992 20:30:37 GMT

In article <00963BF4.675CEA80@vms.csd.mu.edu> 2644danticoj@vms.csd.mu.edu writes:
>My name is Cetera ... can you help me write  these programs, thereby
>allowing me to graduate and go on to serve my country as an officer on a
>nuclear submarine? 

I for one would love to help someone skip a step required to qualify him
or her to server on a nuclear submarine.  I will sleep better at night
knowing that an officer of our nuclear submarine fleet has done
something like this.

I will spare the network a lecture on responsibility and character and
things like that which officers should know about already.

-michael j zehr
From: jeffh@midway.ecn.uoknor.edu (Jeff Horn)
Newsgroups: comp.lang.c
Subject: Help With .pm4 conversion
Date: 18 Nov 92 16:07:00 GMT
Article-I.D.: constell.Bxx63q.DyA
Organization: Engineering Computer Network, University of Oklahoma, Norman, OK, USA

Hello Netters,
	I was wondering in anybody out there knows of an algorithm or a
shareware product that will convert PageMaker .pm4 files to any other
format such as tiff, gif, or pic.  I don't think PBMplus will do it
because .pm4 is a fairly new format (however, I'm too lazy to look).  I
need this because I have alot of slides produced with Pagemaker that I
need to make a slideshow presentation out of and PageMaker doesn't do
any format exchanges.  So if anybody could give me a good kick in the
right direction, I would greatly appreciate it.

Gracias.

Jeff Horn
-- 
Reply_to("Jeff Horn"|"jeffh@mailhost.ecn.uoknor.edu");
"Alice felt dreadfully puzzled.  The Hatter's remark seemed to her to have no
 meaning in it, and yet it was certainly English."
	- Lewis Carroll, Alice's Adventures in Wonderland
Newsgroups: comp.lang.c