HDTenEightyP/NetNews huggingface dataset:
From: olaf@alnitak.usc.edu (Olaf Meeuwissen)
Newsgroups: comp.lang.c,sci.chem,sci.math
Subject: Data structures for graphs/molecules.
Date: 17 Dec 1992 14:50:31 -0800
Organization: University of Southern California, Los Angeles, CA
NNTP-Posting-Host: alnitak.usc.edu

Hello,

Recently,  I  started  writing  a computer program  that  has  to handle  large
molecules, typically in  the order of 1000 to  5000 atoms.  After some  initial
thoughts I reached  the  conclusion  that the main  problem  is  finding a data
structure  most  suited  to  handle  these  kind of molecules  and that  allows
relatively easy  access  to various  sorts of  information. I was wondering  if
anyone has any experience  with a  particular  data structure in  (Ansi) C. The
following gives an idea of the type of information I need.

Since the molecules  are in most cases  macromolecules it makes sense to divide
them into chains  of chemical  units, such as amino acid residues, nucleotides,
monomers or other. I have to be able  to add  or change units at will in  these
chains. Also, I have to be able to add atoms at will, since, in most cases, the
initial data are hydrogen suppressed. Generation of bonds, angles and dihedrals
and updating,  in case  atoms  are  added, are  a must. Further, inspection  of
(parts of) the structure with respect to atoms, bonds, angles and dihedrals has
to be fast enough for  interactive  queries, without upsetting the user because
the  "damned"  program  is  so "bloody" slow. One  final  comment,  most of the
queries  will not  be  too computationally intensive, i.e. calculation  of some
interatomic distances, angles or dihidrals and an occasional  energy associated
with those properties.

For  the less chemically inclined, the whole problem can  be rephrased in terms
of graph  theory  since  atoms  are vertices,  bonds non-directed edges, angles
elementary  chains of length two,  dihedrals  elementary chains of length three
and  units are connected subgraphs. The  isomorphism goes  beyond these things,
but these are the most important.

Personally, I was  thinking along  the  lines of various  linked  lists for the
various properties with "interlist" links  to speed up  access. Any comments on
this  idea  are  welcome.  BTW,  people  providing useful  suggestions will  be
properly acknowledged in the program. The ultimate goal is to make it available
to the scientific community, one  way or another. My boss  and me  differ quite
strongly of opinion on this point (I prefer anonymous ftp).

Thanks,

     ____
    / __ \ /\          ___   Olaf Meeuwissen        (e-mail: olaf@rcf.usc.edu)
   / / / // /____     / __\  Dept. of Chemistry,  Univ. of Southern California
  / / / // // __ \  _/ /     -------------------------------------------------
 / /_/ // // /_/ / /  _/     An eye for an eye  only ends  in making the whole
 \____//_/ \_____\ / /       world blind.
                  /_/                                        -- Mahatma Gandhi
Newsgroups: comp.lang.c
From: dennis@cadkey.com (Dennis Paul Himes)
Subject: Re: WHAT WENT WRONG?
Organization: cadkey
Date: Sat, 19 Dec 1992 01:00:16 GMT

In article <10441.107.uupcb@cutting.hou.tx.us> david.brooks@cutting.hou.tx.us (David Brooks)  writes:
>The following code is intended to compute the factorial of a given
>number. Unfortunately it gives weird results for numbers larger than 12
>or so...
>
>    double x,y;
>
>  [stuff deleted]
>
>    scanf("%d", &x);
>
>  [stuff deleted]
>
>    printf("\nFactorial= %d\n", x);
>
>  [stuff deleted]
>
>Undoubtedly the problem comes from playing with numbers that are too
>big. Is there something obvious that I am overlooking here?
>
>  [stuff deleted]
>
     Yes.  You're using %d for a double.  Use %lf instead.

==============================================================================

               Dennis Paul Himes    <>    dennis@cadkey.com
 
"In watermelon sugar the deeds were done and done again as my life is done
in watermelon sugar."           - Richard Brautigan
From: fjeske@amiganet.chi.il.us (Felix Jeske)
Newsgroups: comp.lang.c
Subject: Re: Question to test general C knowledge
Date: 17 Dec 92 21:38:02 CST
Organization: Amiga Network Information Systems

>     int i = 2;
>      i = ++i;
>   What should the value of i be?
>
>>3.
>
>BZZZT.

Double BZZZT!

The following:

        i=++i;

should be broken up like when taking operator precedence into account:

        ++i;
        i=i;

i is incremented (changing it's value to 3) and then is assigned to itself (a
no-op) so i=3 in the end.

>
>       x = ++i;
>
>means that x is assigned the incremented value of i and
>i is incremented, it in no way requires an ordering of
>these two operations.

Yes it does, the precedence of the = and prefix ++ operators defines the order
of these operations quite clearly.  Since a prefixed ++ has a higher precedence
(cf. K&R) than =, it (the ++) is performed first and the statement should be
broken up as follows:

        ++i;
        x=i;

No ambiguity whatsoever.

Felix
Newsgroups: comp.lang.c
From: leary@progress.COM (James Leary)
Subject: Re: How to test a programmer
Organization: Progress Software Corp.
Date: Fri, 18 Dec 1992 16:09:07 GMT

troyf@microware.com (Troy Frericks) writes:

>This is getting old!  There is more to being a programmer
>than, as others have pointed out, C trivia.  Why not simply
>check references, and ask for a sample of the person's
>code.  If somebody has a BSCS from a school that uses 
>C, that's another plus.

>You should also find out if this person can work as part
>of a team, if he/she can read and write, if their social
>skills are ok (did they wash their hair this month?), can
>they communicate, will they fit in with your organization.

I totally agree with Troy.  To give someone a test that would measure
one's knowledge of obscure C functions and workings misses the point.
Technical ability and experience certainly *do* play an important role
in determining a "fit", but social skills and professional attitude are
equally important.

Another question:  does one fail the interview if the test conditions are
not satisfied?  Having hired Programmers in the past, the steps they took
to try any solve the problem or answer the question are *much* more important
that the actual ability to solve the problem (Kobiashi Maru, anyone?).


--
------------------------------------------------------------------------------
Jim Leary             | My opinions are mine and do not reflect the opinions
Progress Software     | of my employer.
------------------------------------------------------------------------------
From: jian@adx.adelphi.edu (Yang Jian)
Newsgroups: comp.lang.c
Subject: question about MS SDK's dialog box lParam information
Date: 14 Dec 92 19:11:50 GMT
Organization: Adelphi University

Hi there:
	Could anyone please help me on this one.
	I am using MS SDK and MS QuickCWindow(1.0) and I am having problem of
using the dialog box lParam. What I mean is that when I execute the
window program, in the main window, everywhere is active except the
buttons for dialog box. If any one of these buttons is pressed, the entire
screen hangs. No any building errors for the project. Any help or
information or pointers will be appriciated. Thanks in advance.

--Jian
Newsgroups: comp.lang.c
From: dkeisen@leland.Stanford.EDU (Dave Eisen)
Subject: Re: Question to test general C knowledge
Organization: Sequoia Peripherals, Inc.
Date: Fri, 18 Dec 92 20:33:47 GMT

>
>Now, as it happens, I have been unable to think of a way to write a
>compiler such that `i = ++i' would act as if it were `i += 2'---a truly
>dumb compiler will simply emit all preincrements before handling the
>rest of the expression, and a truly smart one will notice that i
>appears twice (and, one hopes, emit a warning) and only generate one
>increment.


Sure, a compiler that is paying attention will recognize "i = ++i"
and emit a warning or do the right thing or whatever. But the
semantically equivalent code:

int i;

foo ()
{
   bar (&i);
}

bar (int *p)
{
   *p = ++i;
}

could easily do the wrong thing and there is no sane way to
make sure that it doesn't.


-- 
Dave Eisen                               Sequoia Peripherals: (415) 967-5644
dkeisen@leland.Stanford.EDU              Home:                (415) 321-5154
       There's something in my library to offend everybody. 
          --- Washington Coalition Against Censorship
Xref: sparky comp.lang.c:18485 comp.std.c:3218
From: swf@tools3teradata.com (Stan Friesen)
Newsgroups: comp.lang.c,comp.std.c
Subject: Re:  Is this ANSI: final (long)
Date: 16 Dec 92 19:19:33 GMT
Distribution: world
Organization: NCR Teradata Database Business Unit

In article <1363@mwtech.UUCP>, martin@mwtech.UUCP (Martin Weitzel) writes:
|> In article <Bz3n1I.73o@unx.sas.com> sasghm@theseus.unx.sas.com (Gary Merrill) writes:
|> :In article <alien.01ss@acheron.amigans.gen.nz>, alien@acheron.amigans.gen.nz (Ross Smith) writes:
|> :|> 
|> :|> ... Why not just
|> :|> use a pointer instead of kludging it up with a fake array?
|> :|> [example deleted]
|> :
|> :The point is this:  If you are dynamically allocating *both* the
|> :structure and the data, the approach you suggest requires *two*
|> :separate allocations (and two separate frees if you will be freeing
|> :the stuff). ...
|>
|> Yes, and there's another point:  With a single allocation you may
|> memcpy/memmove/memcmp/[f]read/[f]write the whole easily. ...

Of course you could solve both problems by using the solution we came up with here:

	struct data {
		char	*dptr
		...
	};

	struct data *dp = malloc(sizeof(struct data) + strlen(string));
	dp->dptr = (char *)dp + sizeof(struct data);

-- 
sarima@teradata.com			(formerly tdatirv!sarima)
  or
Stanley.Friesen@ElSegundoCA.ncr.com
Newsgroups: comp.lang.c
From: shephard@fraser.sfu.ca (Gordon Shephard)
Subject: Re: ...so I typed this in straight from the book...
Organization: Simon Fraser University, Burnaby, B.C., Canada
Date: Sat, 12 Dec 1992 08:22:04 GMT

colinj@monet.ccs.itd.umich.edu (Colin Eric Johnson) writes:

>I typed this in straight in from the Kelly & Pohl book and it
>dumps core every time I try to run it. Lint Hates it (says
>main returns a random value).

>     char  c = 'a', *p, s[MAXSTRING];
>     printf("%s %c%c%s\n", s, *s + 6, *s + 7, *s + 1);

"A Book on C: programming in C / AL Kelley, Ira Pohl - 2nd ed.
Pg. 35
      printf("%s  %c%c%s\n",s,*s+6,*s+7,s+1);
Newsgroups: comp.lang.c
From: sja@snakemail.hut.fi (Sakari Jalovaara)
Subject: Re: Questions about token merging and trigraphs
Organization: Helsinki University of Technology, Finland
Date: 18 Dec 92 12:50:01 GMT


scjones@thor.sdrc.com (Larry Jones) says:
> If you have a better solution to not having some of the C source
> characters available in your local character set, I'd like to hear it. 

Okay.

Allow multibyte representation of C source.  From my reading of the
C standard, this requires no changes (I can't find anything that
disallows such an implementation.)  Trigraphs are already redundant.

Then, EBCDIC machines can represent # with e.g. $= or whatever.
(Assuming typical K&R C implementations on EBDIC machines didn't
already have single character equivalents for # etc.  As you appear
to refer to X3J11 as "we", maybe you know?  Or anyone?)

On the alleged "problem" with national characters  - there *is* no
problem (in the last 6+ years I have every now and then worked with
terminals that use them - so I claim some expertese on this.)  The left
brace might seem like the letter 'a' with dieresis but _every_one_
of the about dozen C compilers I have ever used had *zero* problems
with that.  It is only a matter of _graphical_representation_ of certain
source characters.  A compiler, much less a language standard,
should concern itself with that.  In practice, pressing the single
"a-dieresis" key is (1) easier and (2) is easier to read than ??(
or whatever.  From a compiler's viewpoint, national characters are
only a matter of visual appearance of a few characters on some terminals.

If the committee was concerned about source code portability at the
character level, the standard could have required that *every* compiler
must be able to process ASCII (this could be implemented as a separate
ASCII to native character set converter where needed.)

The short version: trigraphs remain a non-solution to a non-problem.

> lots of people grep'ed lots of code and I think found exactly one
> occurrance [of trigraphs in dusty deck code]

I've found only one too; a certain TeX typesetter previewer for 4014
terminals which tried to write trigraph-like display escape sequences
got screwed.  Took me a while to find, too.
									++sja
Newsgroups: comp.lang.c
From: mcdonald@aries.scs.uiuc.edu (J. D. McDonald)
Subject: Re: Question to test general C knowledge
Organization: UIUC SCS
Date: Fri, 18 Dec 1992 19:47:03 GMT

In article <1992Dec18.182206.29158@mksol.dseg.ti.com> mccall@mksol.dseg.ti.com (fred j mccall 575-3539) writes:


>>>Actually, I prefer the more obfuscated form:
>>>  4["this is a test"]
>>>
>>>And ask them what the type and value is, and WHY this expression is legal.

>>We all know what the type and value is (well it's if type char and
>>has value ' ' for those who don't know)

Well, it has value ' '.

But is it type char?? 

If it is an expression, it **can't** have type char, because any expression
promotes type char to type int.

So: is it an expression? Or is it a non-expression (i.e. plain type) char?

Doug McDonald
Xref: sparky comp.lang.c:18712 comp.os.msdos.programmer:11538
From: paranjpe@leland.Stanford.EDU (Milind D Paranjpe)
Newsgroups: comp.lang.c,comp.os.msdos.programmer
Subject: Power C (MIX C) Compiler QUESTION
Date: 20 Dec 92 19:12:39 GMT
Organization: DSG, Stanford University, CA 94305, USA

Hello:

I'm trying to use Power C to generage object files to link with Turbo Pascal.
To do this, I'm using the /q compiler directive to make Microsoft compatible
object files.  But the option seems to have no effect.  I can't link the
resulting object file with the Pascal program.  Has anyone used the /q option
in Power C successfully??

EMAIL would be much appreciated.

Milind Paranjpe
paranjpe@leland.stanford.edu
From: cbumg@miller.cs.uwm.edu (Christoph Bumgardner)
Newsgroups: comp.lang.c
Subject: C Gazette Bk Issues - Wanted
Date: 18 Dec 1992 16:32:57 GMT
Organization: University of Wisconsin, Milwaukee
Distribution: usa
NNTP-Posting-Host: 129.89.9.13


Hi -

I am looking for some back issues for the C Gazette to fill some holes
in my set.  If you have any please e-mail me.  (I'm looking for some
Microsoft Systems Journal back issues as well).

Thanks,
Chris

-- 

	Internet:   cbumg@miller.cs.uwm.edu

Newsgroups: comp.lang.c
From: volpe@bart.NoSubdomain.NoDomain (Christopher R Volpe)
Subject: Re: Question to test general C knowledge
Reply-To: volpe@ausable.crd.ge.com
Organization: GE Corporate Research & Development
Date: Sun, 13 Dec 1992 04:58:28 GMT

In article <1992Dec12.224541.29854@thunder.mcrcim.mcgill.edu>, mouse@thunder.mcrcim.mcgill.edu (der Mouse) writes:
|> In article <1992Dec11.175620.20308@crd.ge.com>, volpe@bart.NoSubdomain.NoDomain (Christopher R Volpe) writes:
|> > In article <PTmLVB4w165w@quest.UUCP>, kdq@quest.UUCP (Kevin D. Quitt) writes:
|> >> jfw@ksr.com (John F. Woods) writes:
|> 
|> >>> 	int i = 2;
|> >>> 	i = ++i;
|> >> If they say other than "it's undefined", *then* don't hire them.
|> > This is an interesting question.  Is the value of I really being
|> > modified more than once?  There are two assignment operations going
|> > on, true.  But, does assigning a variable the value that it already
|> > has constitute a modification?
|> 
|> It may not have that value yet, if the increment side-effect is
|> deferred.

You miss the point. One of them will happen first. Does the second
one constitute a modification? Look at it this way: When the "++" operator
is evaluated, the machine throws a card up in the air with the words
"put 3 in i" on it. That's the side effect associated with the "++" operator.
And since the value of the "++i" subexpression is "3", when the "=" 
operator is evaluated, the machine throws up another card in the air with
the words "put 3 in i" on it. The side effects are applied in the order
in which they fall. But since both side effects do the same thing, is 
the object really being "modified" again when the second card falls?

A clearer example illustrating the issue I raise would be the following:

    i = (i = 4)

Is the behavior of that expression undefined? Maybe, depending on
the definition of "modify". Is any reasonable implementation likely
to leave anything other than 4 in i? I doubt it. 

|> 
|> 					der Mouse
|> 
|> 			    mouse@larry.mcrcim.mcgill.edu

-- 
==================
Chris Volpe
G.E. Corporate R&D
volpecr@crd.ge.com
Newsgroups: comp.lang.c
From: gjb7307@Msu.oscs.montana.edu
Subject: Re: turboc
Reply-To: gjb7307@Msu.oscs.montana.edu
Organization: Montana State University
Date: Sat, 19 Dec 1992 07:18:28 GMT

In article <1992Dec18.140840.891@nrlvx1.nrl.navy.mil>, donohue@nrlvx1.nrl.navy.mil writes:
>This is a followup to the turbo C question I had posted earlier
>This code works in vax C, but when it is called in turbo c it produces 
>a float

add this code

float f1;
sscanf("3.1","%f",&f1);

to link in the floating point package (for real)
or see page 281 of the Programmer's Guide

and, ignore people who don't like gotos.  i don't
use them but they do have their place and they
are not inefficient.  the source code for most of your
standard libraries even contains goto statements.
i might've written it differently myself but that's
irrelevant.  bye

flame on

Newsgroups: comp.lang.c
From: misar@rbg.informatik.th-darmstadt.de (walter misar)
Subject: Re: Questions about token merging and trigraphs
Date: Mon, 14 Dec 1992 09:57:53 GMT
Organization: TU Darmstadt

In article <42098@pprg.eece.unm.edu.pprg.unm.edu>, ele@chama.eece.unm.edu writes:
> 
> Two questions about ANSI C:
> 
> (1) How is the preprocessor token merging mechanism (##) supposed to
> be used?  I know, for example that if you have
> 
> #define X(i)  x ## i
> 
> then the preprocessor will replace code like 'X(1)' with 'x1', but
> could someone give me an example of where this (or some other use of
> '##') would be useful?

I used it once
/* flags */

#define F_C     1<<0    /* Carry        */
#define F_Z     1<<1    /* Zero         */
#define F_I     1<<2    /* Interrupt    */
#define F_D     1<<3    /* Decimal      */
#define F_B     1<<4    /* Break        */
#define F__     1<<5    /* - unused -   */
#define F_V     1<<6    /* oVerflow     */
#define F_N     1<<7    /* Negative     */

#define SET(flag)       (P|=(F_##flag))
#define CLR(flag)       (P&=(~F_##flag))
#define EQU(flag,val)   ((val)?SET(flag):CLR(flag))
#define QUERY(flag)     (!!(P&F_##flag))

Now you can call SET(C) and it will set the C-flag (BTW this flags are 6502).


> (2) There is a command-line switch to disable the 'trigraph' feature
> in the gcc compiler.  What are trigraphs?  From the comments in the
> gcc documentation I gather that they are something that the ANSI
> committee has added to C and that Richard Stallman doesn't care for
> them.  If that is the case, I'm wondering what purpose the ANSI
> committee saw for them, why anyone would object to them, and, most
> importantly, what they are.

Trigraphs are only of interest, if your machine hasn't got a full set of ASCII
characters. All begin with ??, only following nine replacements take place:
??( [   ??< {   ??' ^
??) ]   ??> }   ??- ~
??= #   ??! |   ??/ \ 
The replacement takes effect before any other preprocessor action, thus ??/
may be used at the end of a line to merge it with the next. In general, I can't
see a good reason for it - I can't believe one will actually programm s.th like
this (Yeah it's ANSI)

??=include <stdio.h>
int main(int argc,char * argv??(??))
??<
printf("Hello world !")
return 0;
??>

Worse, trigraph can turn otherwise correct programs into garbage (especially
??! is a prime candidat)
-- 
Walter Misar                        It is impossible to enjoy idling thoroughly
misar@rbg.informatik.th-darmstadt.de       unless one has plenty of work to do.
Newsgroups: comp.lang.c
From: josteisv@dhhalden.no (JOSTEIN SVENDSEN)
Subject: Intelligent C source code printing program
Organization: Ostfold College
Date: Sat, 12 Dec 1992 01:08:32 GMT

I suppose this questions has been asked before, but I've have been looking 
for an intelligent C source code printing utility for weeks without 
succeding incl. looking in the FAQs, and now I have to try here.

Does it exist an intelligent C source code printing utility for Dos/Windows?
I need an utility which allows selecting lots of files, and printing out the 
files with different fontattributes to make the code easy to read. If the 
program also make an simple analyze of the code, like headlighting comments 
and keywords, it would have been nice.

There is a excellent program called Pretty C for the Mac platform, but I 
need something which is compatible with code for compilers like Borland C++.

Any help is appreciated! I will summarize here if necessary.

Jostein :-)

-----------------------------------------------------------------------------
Mosher's Law of Software Engineering:

Don't worry if it doesn't work right.  If everything did, you'd be out of a job.
=============================================================================
| Jostein Svendsen                      |                        PO Box 587 |
| <josteisv@sofus.dhhalden.no>          |                     N-1754 HALDEN |
| CS-Student, Ostfold Regional College  |                            NORWAY |
=============================================================================
From: d_north@ondec.lonestar.org (David G. North, CCP)
Newsgroups: comp.lang.c
Subject: Re: Question to test general C knowledge
Date: 12 Dec 92 17:14:08 GMT
Organization: onDEC systems, Dallas, TX

In article <Bz0A46.Cvu@watserv1.uwaterloo.ca>,
  dmeister@mansci1.UWaterloo.ca (Darren Meister) writes:
> this but, if you could ask someone one question to test if they
> generally understand C what would it be. Thanks for your responses.
After all the recent hubbub under the topic 'what do you say?'
How about:
  What's the difference between '=' and '=='?
:):):)
Or better yet, what is the type and value of the following expression:
  "this is a test"[4]
-- 
David G. North, CCP
d_north@ondec.lonestar.org {...!texsun!montagar!ondec!d_north}
onDEC systems                                 "Everyone's crazy but you & me...
P.O.Box 795848, Dallas TX  75379-5848          and come to think about it, I'm
(214)985-1316 ... (214)902-3957                not so sure about you either!"
Newsgroups: comp.lang.c
From: jlg@cochiti.lanl.gov (J. Giles)
Subject: Re: Question to test general C knowledge
Organization: Los Alamos National Laboratory
Date: Mon, 14 Dec 1992 22:24:13 GMT

In article <1992Dec14.164400.59891@ns1.cc.lehigh.edu>, dsbb@ns1.cc.lehigh.edu (D. SPENCER BEECHER) writes:
|> How about:
|> 
|> What is the difference between:
|> 
|> varname%3
|> 
|> and
|> 
|> varname&0x02
|> 
|> and why might one be more advantageous to use?

Well, one of them extracts the remainder after division of `varname'
by three and the other extracts the second from the bottom bit (which
is considerably different from remainder modulo three).  The bitwise 
AND might be faster on most machines (since it does not do a divide - 
typically one of the slowest instructions).  But, since these two have
little functionality in common, it's difficult to tell why you're
comparing them.  Maybe you intended to compare:

   varname%4

to

   varname&03

These two do the same thing if `varname' is a positive (or unsigned)
integer variable.  They may behave differently if `varname' is negative
or if it's not an integer.  The AND is still faster.

-- 
J. Giles
Newsgroups: comp.lang.c