HDTenEightyP/NetNews huggingface dataset:
From: dave@cs.arizona.edu (Dave Schaumann)
Newsgroups: comp.lang.c
Subject: Re: C palindrome puzzle: a solution
Date: 6 Jan 93 21:45:31 GMT
Reply-To: dave@cs.arizona.edu (Dave Schaumann)
Organization: University of Arizona

[the rules: write a C program that's a palendrome and prints out "hello, world"

In article <C0DuoE.7M8@sci.kun.nl>, ronny@cs (Ron Wichers Schreur) writes:
>I'll only post the second half of my program:
>
>    ab(( b enifed#
>    cd enifed#
>    cb bc enifed#
>    ;dc int enifed#
>    diov main enifed#
>    niam tni void enifed#
>    };0 nruter;dc"dlrow olleh"cb stup{
>    ) dc enifed#
>    )diov cb niam tni
>    ab( cb enifed#
>    >h.oidts<edulcni#
>    ab enifed#
>    )ab(ba enifed#
>    ;)diov(niam tni
>
>It must be possible to find a shorter version. If
>you do, I'd be interested in your solution.

Here's a slightly shorter solution (using the same basic idea as yours):

    ea(( x enifed#
    )x(ae enifed#
    };0 nruter;)"dlrow olleh"(stup{
    )diov(niam tni
    }{ int enifed#
    ) main enifed#
    >h.oidts< edulcni#
    ;)diov(niam tni

Again, this is only the second half of the program.  BTW, I'd suggest that
anyone who tries their hand at this mechanically verify the solution is
a palendrome.  It's easy to screw up.

-- 
Caught an internal error--.brainrc restored
Xref: sparky comp.lang.c:19432 comp.lang.perl:7721 comp.unix.programmer:5866 comp.sources.d:1529 comp.unix.questions:15330
From: johnb@cadreor.cadre.com (John Blattner)
Newsgroups: comp.lang.c,comp.lang.perl,comp.unix.programmer,comp.sources.d,comp.unix.questions
Subject: Re: C source code analysis tools
Date: 8 Jan 93 17:51:01 GMT
Article-I.D.: cadreor.1993Jan8.175101.11621
Distribution: comp
Organization: Cadre Technologies Incorporated, Beaverton, Oregon.

faigin@aero.org (Daniel P. Faigin) writes:

>[I have been asked to post the following for a collegue (Jim Knoke) who does
>not have access to Usenet. Please forward replies to him directly
>(Knoke@dockmaster.ncsc.mil). You may also send them to me, and I'll forward
>them on to him. Thanks in advance -- Daniel]

>  
>    The TCB Devlopment group at HFS Inc. is looking for 'C' source code  
>analysis tools (or scripts) which can produce calling trees and global  
>data cross references.  We are aware of "xref", "cflow", and "perl",  
>but they are not as powerful or flexible as we would like.  
>    We would like calling trees in both directions: "called by" and  
>"calls to".  There should be a way to denote calls from the hardware  
>or from separately linked software.  Both function and file names should  
>be shown.  It should be possible to ignore calls to library routines.  
>It should not be difficult to manually add assembly language calls to the  
>trees.  It should be possible to treat macros as functions.  
>    The global data cross reference must include references through pointers.  
>Dynamically created global data must be included, possibly with the  
>assistance of a manually included list of dynamic structures.  Formal  
>parameters, local variables, and constants must be ignored.  

>Jim Knoke (Knoke@dockmaster.ncsc.mil)
>(relayed via Daniel Faigin at the address below)
>--
>[W]:The Aerospace Corp. M1/055 * POB 92957 * LA, CA 90009-2957 * 310/336-8228
>[Email]:faigin@aerospace.aero.org              [Vmail]:310/336-5454 Box#13149
>		    "And as they say, the rest is compost"


Ensemble is a suite of tools for the C development and maintenance
engineer. The code analysis or reverse engineering tools generate
structure charts with calling hierarchy and parameter passing info, and
cross reference reports. The tools provide additional structure and
logic reverse engineering, quality metrics calculations, test case
generation, test execution profiling, and design documentation
generation. Ensemble is currently shipping on Sun Sparc and HP700.
Ensemble will be shipping on IBM RS6000 and DEC Ultrix in Q1, 1993.
Ensemble works with ANSI, K&R, and Microsoft dialects including the
extensions for the workstation compilers and many cross compilers.

For more information, please contact Cadre Technologies at
1-800-743-2273 or (401) 351-5950.

John Blattner 
Cadre Technologies Inc.  
johnb@cadre.com
Newsgroups: comp.lang.c
From: mccall@mksol.dseg.ti.com (fred j mccall 575-3539)
Subject: Re: Moving from Pascal to C, Help please!!!!!! 
Organization: Texas Instruments Inc
Date: Tue, 12 Jan 1993 19:08:26 GMT

In <726510754snz@panache.demon.co.uk> raph@panache.demon.co.uk (Raphael mankin) writes:

>In article <4293@dozo.and.nl> jos@and.nl writes:

>>
>>Another way to approach pointer arithmetic is first to convert the
>>pointer(s) to character pointer(s): [ ... ] For pointer subtracion,
>>the result of the difference between the character pointers is 
>>similarly divided by the size of the object originally pointed to.
>>

>IMHO the only thing one can say about pointer arithmetic is DON'T.

There's singularly bad advice from someone with that much experience.

>Regardless of what K&R or the standard say about its legality, tinkering
>with pointers is one of the surest ways of getting into trouble. 30 years
>of programming, in more languages than most readers of this group have even
>heard of, has led me to this position.

Then your experience hasn't been in C, in which arrays are NOT
first-class objects.  'Tinkering' with pointers is one of the basic
building blocks in the language.

>If your pointer points to an array, use subscripting. Let the compiler's
>optimiser work out whether there are really better ways of doing the job.

And what do you do when a pointer is passed to a function?  Punt?

>If your pointer is to a single item, then the only thing you should do with it
>is to follow it (dereference).

You may have a lot of experience in things most people have never
heard of (although I'd bet that a lot of us could probably say the
same to you), but you don't appear to have sufficient experience in C
to be making such statements.

-- 
"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.
Newsgroups: comp.lang.c
From: ctoth@magnus.acs.ohio-state.edu (Christopher M Toth)
Subject: C if else statements HELP
Organization: The Ohio State University
Date: Fri, 8 Jan 1993 16:07:40 GMT

	Hi! I just started learning C and have run into problems with
'if' and'else' statements. I have a program that I am *trying* to write. The
basic format is:

	printf ("which do you choose?");
	scanf("%d", &n);
	choice#1
	choice#2
	choice#3
	choice#4

	if choice #1
		printf.....
	if choice #2
		printf.....
	if choice #3
		printf.....
	if choice #4
		printf.....

	I want the program to goto the approiate section when the user
inputs either 1,2,3,or 4. ANy help would be greatly and mostly appreciated! :)

Thanks!

-- 
Christopher M. Toth             | "... We travel in the dark of a new moon
The Ohio State University       | A starry highway traced on the map of the sky
Columbus State                  | Like lovers and heroes,
CIS/History/Classics/ect..Major | Lonely as the eagle's cry..." -Peart
Newsgroups: comp.lang.c
From: obaid@sdf.lonestar.org (Obaid Alvi)
Subject: Re: Dynamic loading of functions
Organization: sdf public access Unix, Dallas -- 214-436-3281
Date: Thu, 7 Jan 1993 03:13:31 GMT


MS Windows and OS/2 solve this problem by implementing dynamic link
libraries or DLLs.  Under Unix, I dont know.

signed amjad;
From: Matt@chchp.ac.nz (Matt Thompson)
Newsgroups: comp.lang.c
Subject: HELP Please Please (malloc on an array)
Date: Wed, 6 Jan 1993 02:43:23 GMT
Organization: Christchurch Polytechnic
Distribution: World
NNTP-Posting-Host: 192.203.99.76


All I need to do is create an array of strings in memory. Not a hard task at 
all. I can do this easily using the following code but I have had problems 
trying to do this dynamically with malloc etc. I haven't used malloc much 
and don't have the time to get it by trial and error.

Could someone please help me as I need to get this done very quickly.


Code using standard char array
------------------------------
main()
{
char array1[1000][11];
int temp;

for(temp=0;temp<999;temp++)
   sprintf(array1[temp],"Test %d",temp);

printf("\n\nEnter a number :");
scanf("%d",&temp);
printf("\n%s",array1[temp]);
}



Code using malloc etc
---------------------

(fill in here, Please)




Thanx in advance.

Matt Thompson
Software Technician
Christchurch Polytechnic
New Zealand
From: hartman@ulogic.UUCP (Richard M. Hartman)
Newsgroups: comp.lang.c
Subject: Re: Dynamic loading of functions
Date: 5 Jan 93 01:01:21 GMT
Organization: negligable

In article <1993Jan3.230943.11026@vax.oxford.ac.uk> ayoung@vax.oxford.ac.uk writes:
> Is there a portable way to load and execute a function in an object file from
> a running program? I'm writing a program that does some math stuff and I'd
> like to allow users to write their own functions to suppliment the supplied
> functions.

Portable?  No.
Possible?  Perhaps.

In the MS-DOS arena a set of routines to do this was published a few
years ago in Dr. Dobbs Journal.

Try the DDJ section of Compuserve, they probably have all the information.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Between the silence of the mountains	|
and the crashing of the sea 		|	-Richard Hartman	
there lies a land I once lived in	|	hartman@uLogic.COM
and she's waiting there for me.		|
From: johnb@cadreor.cadre.com (John Blattner)
Newsgroups: comp.lang.c
Subject: Re: Code Analysis Tools Info Request
Date: 8 Jan 93 17:55:21 GMT
Article-I.D.: cadreor.1993Jan8.175521.12117
Organization: Cadre Technologies Incorporated, Beaverton, Oregon.

jacobs@erc.cat.syr.edu (David Quinn-Jacobs) writes:

>I am looking for code analyis tools (other than cflow and cxref) which
>perform the following functions:

>    o    Cyclomatic Complexity Analysis (McCabe)
>    o    Calling Trees (graphic or textual)
>    o    Cross Referencing (particularly noting global variable usage)

>It does not matter if the tools are commercial or in the public domain.  (If 
>they apply to Fortran as well as C, that is a plus.)

>Please post replies to the following email address since I cannot access
>news very often.  Thanks in advance.
>----------------------------------------------------------------------------
>Dave Quinn-Jacobs                           Phone: (315) 724-1100
>The Analytical Sciences Corp. (TASC)          FAX: (315) 724-3330
>555 French Rd.                              Email: jacobs@erc.cat.syr.edu
>New Hartford, NY 13413
>-- 
>------------------------------------------------------------------------------
>   			       David Quinn-Jacobs

>		  *          Plainfield Associates


Ensemble is a suite of tools for the C development and maintenance
engineer. The code analysis or reverse engineering tools generate
cyclomatic complexity metrics, structure charts with calling hierarchy
and parameter passing info, and cross reference reports. The tools
provide additional structure and logic reverse engineering, quality
metrics calculations, test case generation, test execution profiling,
and design documentation generation. Ensemble is currently shipping on
Sun Sparc and HP700. Ensemble will be shipping on IBM RS6000 and DEC
Ultrix in Q1, 1993. Ensemble works with ANSI, K&R, and Microsoft
dialects including the extensions for the workstation compilers and
many cross compilers.

For more information, please contact Cadre Technologies at
1-800-743-2273 or (401) 351-5950.

John Blattner
Cadre Technologies, Inc.
johnb@cadre.com
From: bq274@cleveland.Freenet.Edu (Andy J. Berkvam)
Newsgroups: comp.lang.c
Subject: Turbo C & EMS - How to find total installed
Date: 8 Jan 1993 23:39:36 GMT
Organization: Case Western Reserve University, Cleveland, OH (USA)
Reply-To: bq274@cleveland.Freenet.Edu (Andy J. Berkvam)
NNTP-Posting-Host: hela.ins.cwru.edu


  I am writing a program that gathers information about the PC it is 
run on.  I would like to find the total amount of installed EMS memory.
All the code I have found doesn't seem to be able to deal correctly with
LIM EMS 4.0 (it assumes 16K code pages).

  Maybe I am not understanding EMS correctly either.  Anyway, any help
with finding out how much EMS is installed (or even if it is installed)
would be appreciated.

Thanks

Andy


-- 
Andy Berkvam                          |  Few are wholly dead:
U of Wisconsin - Stevens Point        |  Blow on a dead man's embers
Cleveland Freenet: bq274              |  And a live flame will start.
Internet: aberkvam@spu1.uwsp.edu      |                -Robert Graves
Xref: sparky comp.lang.c:19404 misc.jobs.contract:4896
From: aabdalla@pollux.usc.edu (AAA)
Newsgroups: comp.lang.c,misc.jobs.contract
Subject: HELP!  6805 C compiler needed yesterday...
Date: 7 Jan 1993 23:08:36 -0800
Organization: University of Southern California, Los Angeles, CA
NNTP-Posting-Host: pollux.usc.edu

Help!  I need to know whether there are compilers/emulators/development
kits for writing C source for embedded applications using a 6805 (the
Motorola 6800 family) microprocessor.  I would deeply appreciate a quick
reply if possible containing the names of companies who have such products.
As soon as possible is best since it relates directly to a possible job/
contract - and the bids are due by Friday!

Thanks a lot!

AAA
PS: Help!

Newsgroups: comp.lang.c
From: mat@mole-end.matawan.nj.us
Subject: Re: Any hope for me..?
Summary: Is there any hope for the CS major ...
Organization: :
Date: Fri, 8 Jan 1993 17:17:28 GMT

In article <C0Hty1.DvH@netnews.jhuapl.edu>, bandy@netnews.jhuapl.edu (Mike Bandy) writes:
> raph@panache.demon.co.uk (Raphael mankin) writes:
 
> >When I employ programmers I prefer those with a degree in English or History
> >or Physics, or anything except CS. They tend to have more rounded knowledge
> >and don't think that they know it all.
 
> >...
 
> I've had the (mis)fortune to work with a lot of EEs who were thrown
> into programming without any college computer coursework.  ...
 
> Why is it that they'll let anyone program, but let a non-EE major (for 
> example) apply for an EE job, and he's eliminated from consideration 
> immediately?

Because we know, more or less, how to teach EE.  We don't know how to teach
applied CS.  We can't teach `programming with the necessary theory' because
we don't know what that theory _is_.

Perhaps the best person is someone who learned how to program outside the
CS structure, _then_ got a CS degree.  (Like me ;'}, of course.)
-- 
 (This man's opinions are his own.)
 From mole-end				Mark Terribile

 mat@mole-end.matawan.nj.us, Somewhere in Matawan, NJ
From: Aurelius@cup.portal.com (Mark Christian Barnes)
Newsgroups: comp.lang.c
Subject: Re: struct vs. typedef
Date: Mon, 11 Jan 93 23:09:01 PST
Organization: The Portal System (TM)
Distribution: na
  <JAR.93Jan10152829@solva.ifi.uio.no> <1993Jan11.170937.22822@informix.com>

johnl@informix.com (Jonathan Leffler) writes:

|In article <JAR.93Jan10152829@solva.ifi.uio.no>
| jar@solva.ifi.uio.no (Jo Are Rosland) writes:
|>In article <uRL4wB7w165w@cybrspc.uucp> Roy M. Silvernail writes:
|>
|>   typedef struct n {
|>	int x,y;
|>	struct n *last,*next, *up, *down;
|>	void (*show)(struct n *);
|>	int width;
|>	void **value;
|>   } ITEM;
|>
|>   Now, this works, but it sure seems clumsy.  Is this really the only way
|>   to do this type of construct?  If not, is it the optimal solution, or is
|>   there some extremely clever trick I'm missing?
|>
|>Given C, that's the best you can get.  You'll just have to get used to
|>it, just like the rest of us :-).
|
|Not so:
|
|typedef struct n ITEM;
|struct n {
|       int x,y;
|       ITEM *last,*next, *up, *down;
|       void (*show)(ITEM *);
|       int width;
|       void **value;
|};  
|I prefer the style:
| 
|typedef struct Tag Tag;
|struct Tag
|{
|        ...
|};
|where the structure tag and the typdef name are the same -- it gets closer to
|C++ that way.  

 Yes I declare structures and unions nearly this way myself. My
preference is to keep the declaration atomic though...

typedef struct TagS		/* declare type TagS */
{
 struct TagS *head;
 struct TagS *tail;
} TagS;

TagS aTag, *pTag = &aTag;	/* declare some variables */

This requires that any recursive structure references say "struct",
but everywhere else the typedef name is enough.

			Regards, Aurelius@cup.portal.com
From: alane@wozzle.linet.org (J. Alan Eldridge)
Newsgroups: comp.lang.c
Subject: Re: Problem with Turbo-C: calculating with pointers
Date: 10 Jan 93 16:36:37 GMT
Organization: Disorganization

derijkp@reks.uia.ac.be (Peter De Rijk) writes:

> I am porting a program (working on different platforms such as VAX and DEC) t
> the PC. I am using Turbo C++ v.3.0. I compile using the huge memory model.
> I seem to have tracked down the problem (well, one of the problems.) I don't
> know what to do about it though. Here's a little program to illustrate the
> problem:
> 
> #include <alloc.h>
> 
> main()
> {
> char *pointer,*begin,*end;
> long size;
> 
> size=71800;
> pointer=(char *)farmalloc(size*sizeof(char));
> begin=pointer;
> end=pointer+size;
> printf("%p %p %ld",begin, end, end - begin);
> }
> 
> I would expect end - begin to return 71800. However it seems to return 6264.
> This is exactly 64K less.

You have to explicitly declare huge pointers, even in huge model. Make
your var definitions:

char huge *pointer, huge *begin, huge *end;

This should clear things up for you. BTW It's in the manual... somewhere...

alane@wozzle.linet.org (J. Alan Eldridge)
Fido: The University of Walamaloo 1:272/38.473
From: keith@torme.sharebase.com (Keith Chambless)
Newsgroups: comp.lang.c
Subject: Re: readable code
Date: 8 Jan 93 23:29:21 GMT
Reply-To: keith@torme.sharebase.com (Keith Chambless)
Organization: NCR/ShareBase Corporation

In article <1993Jan8.123037.12575@druid.uucp> darcy@druid.uucp (D'Arcy J.M. Cain) writes:
>
>Why isn't there a +x+ construct for those who can't decide?
>

That's positively repulsive.

>P.S: BIG :-)
>

ditto.
Newsgroups: comp.lang.c
From: rs@cmie.ernet.in (Rajappa Iyer)
Subject: Re: sccs eats good code -
Organization: Centre for Monitoring Indian Economy, Bombay
X-Newsreader: Tin 1.1 PL4
Date: Thu, 7 Jan 1993 05:50:31 GMT

rince@dcs.warwick.ac.uk (James Bonfield) writes:
: [ much stuff about sccs and rcs deleted ]

: The next time I decide to use a control system I'll probably investigate CVS
: as I've heard so many good (and only good) reports.

Of course, you will learn that CVS is a (well, sort-of) front end to RCS.

-- 
Rajappa Iyer			rs@cmie.ernet.in (Preferred)
				riyer@shakti.ncst.ernet.in
Newsgroups: comp.lang.c
From: ritc0003@student.tc.umn.edu (Kent Ritchie)
Subject: Writing keyboard input to a file
Organization: University of Minnesota
Date: Tue, 5 Jan 1993 17:45:18 GMT

Hi-

Excuse me if this is the wrong group to ask but...  Has anyone written a
program or know of one that will run in the background on a MS-DOS 
machine that will capture *everything* typed on the keyboard  and write it to
a file?  Please email responses.  Thanks.


--
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
^Kent C. Ritchie    "The power of equality      ritc0003@student.tc.umn.edu^ 
^Physics 136         is not yet what it ought     kritchie@mvax.spa.umn.edu^
^626-0235            to be"  -Chili Peppers     Fido: Kent.Ritchie 1:282/31^
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Newsgroups: comp.lang.c,comp.lang.pascal,comp.lang.prolog
From: nharvey@probitas.cs.utas.edu.au (Nicole Harvey)
Subject: Assessing a language
Organization: University of Tasmania, Australia.
Date: Wed, 6 Jan 1993 01:58:04 GMT


hi,
   I am involved in assessing a language. Does anyone know of a standard
set of problems that I could use to judge the languages compabilities?
   Can anyone think of a problem that represents a real need in a language?
For example, we have tested it for the eight queens problem to show that 
it can do state space searches. We have also made sure it can generate the 
Fibonacci numbers. Can you think of any other well known problems?
   What things do you expect to be able to write relatively simply using any
language? I would like to here from people working in all areas. 

Nicole
nharvey@probitas.cs.utas.edu.au

Newsgroups: comp.lang.c
From: md@sco.COM (Michael Davidson)
Subject: Re: use of REALLOC under UNIX system
Organization: The Santa Cruz Operation, Inc.
Date: Tue, 12 Jan 1993 17:08:19 GMT


michi@ptcburp.ptcbu.oz.au (Michael Henning) writes:

>md@sco.COM (Michael Davidson) writes:
>>- the only valid thing that you can pass to realloc()
>>as it's first argument is the pointer returned from a successful
>>call to malloc(), calloc() or realloc(). In other words, you can't
>>RE-allocate something that you have never allocated in the first place!

>No. Under ANSI C, realloc() can be passed a NULL pointer, in which case
>it behaves as if malloc() was called. Initializing clast_str to NULL
>will fix the problem, if libc conforms to ANSI C.

Yes - you are correct about what ANSI allows, however there are still a
lot of non-ANSI implementations around so I think that my advice was
a little more general. In the specific example quoted by the original
poster simply initialising clast_str to NULL isn't enough since passing
a NULL pointer to strlen() is, as far as I know, *not* allowed by ANSI
(and even if it were, it would, IMHO, be such bad programming practice
that I would never advise anyone to do it).

Anyway, I suspect from what the original poster was trying to do and
the way in which they were approaching the problem, that what they *really*
need is to get themselves a good book on C programming and pay special
attention to the section on pointers....

Xref: sparky comp.lang.c:19506 comp.lang.c++:18903