HDTenEightyP/NetNews huggingface dataset:
From: rince@dcs.warwick.ac.uk (James Bonfield)
Subject: Re: Followup on size of executables.
Organization: Department of Computer Science, Warwick University, England
Date: Mon, 4 Jan 1993 14:21:21 GMT

In <93004.051358RVK@psuvm.psu.edu> <RVK@psuvm.psu.edu> writes:

> This brings me to my final question: Is there no way other than
> programming in assembly, to produce a really small executable?
> I would like to use C, but I don't know how (if at all possible)
> to do that.

This all depends on your system architecture and the flags on your compiler
and linker. It is perfectly possible (on a Sun anyway) to produce very small
neat binaries from a C compiler, although you may lose some wanted things
(such as read-only text segment and page aligned segments).

$ cat hw.s
        .seg    "text"
        .global _main
ping:
        .ascii  "Hello, World!\n"
	.align	4
_main:
        mov     1,%o0                   ! 1st arg of write
        sethi   %hi(ping),%o1           ! 2nd arg
        mov     14,%o2                  ! 3rd
        mov     0x4, %g1
        ta      %g0                     ! call write
        mov     0x1, %g1
        ta      %g0                     ! call exit
$ as hw.s -o hw.o
$ ld -s -N -e _main hw.o -o a.out
$ ./a.out
Hello, World!
$ ls -l a.out
-rwxr-xr-x  1 jkb      staff          80 Jan  4 11:47 a.out

(Astute readers will notice that changing the exec header and lopping off the
last few bytes can result in a workable executable of size 74 - but this
requires some intervention with a text editor and so is really a side issue.)

In C it is also possible to create small binaries.

$ cat b.c
main() {
    write(1, "Hello, World!\n", 14);
    _exit(0);
}
$ cc -O4 -c b.c
$ ld -s -n -e _main b.o -o a.out -lc
$ ./a.out
Hello, World!
$ ls -l a.out
-rwxr-xr-x  1 jkb      staff         160 Jan  4 14:11 a.out

Ok - so it's twice the size of the original program. This is of course a
significant improvement on the 16K a normal compiled (and stripped) executable
would be.

This is all quite likely irrelevant to your case: as I said these things are
system dependant. The reason this works here is that by using ld explicitely
we can remove the need for dynamic linking and the inclusion of the crt0.o
code. This of course will make binaries larger for big programs, and also has
the side effect of not setting up our command line arguments (and environment
pointer) correctly.

-- 
James Bonfield (jkb@mrc-lmba.cam.ac.uk / rince@dcs.warwick.ac.uk)
Medical Research Council Laboratory of Molecular Biology, Hills Road,
Cambridge, CB2 2QH, England. Tel: 0223 402499   Fax: 0223 412282
Newsgroups: comp.lang.c,rec.humor
From: ahoekstr@cs.utwente.nl (Andre D. Hoekstra)
Subject: Re: Program to convert .EXE to a "C" source file?  I really need one!!
Organization: Twente University, Dept. WB/WA (NOT cs)
Date: Mon, 4 Jan 1993 15:01:59 GMT

In article <1993Jan4.022241.4493@pony.Ingres.COM> mikes@Ingres.COM (Mike Schilling) writes:
>From article <1993Jan2.203527.27050@news2.cis.umn.edu>, by dutc0006@student.tc.umn.edu ():
>> In article <1993Jan1.225604.964@blurt.oswego.edu> ch_ind05@blurt.oswego.edu (Greg Fuller (SUNY Oswego, Oswego New York)) writes:
>>>Hello. 
>>>	I am looking for a program that will take a .EXE or .COM file and
>>>convert it into a "C" source file.  I saw one on one of the FTP sites today,
>> [Stuff deleted]
>> 	I am looking for a program of that nature too.  If someone knows 
>> where one can be FTP'd I would appreciate E-Mail telling me.  
>> 				Thanks,
>> 				dutc0006@student.tc.umn.edu			
>> 
>I'd prefer a program that generates the RCS or SCCS archives the program was 
>developed in, plus a makefile.  Architectural and design documents would be 
>nice too.
Have you seen that tool that compiles all this output into the new version
of the package? I once saw someone use a few commands to decompile
WordPerfect 2.0 and bring it in successive stages to WP 5.1!!
(I believe this was called reveng.com (reverse engineering) and upgrade.exe?)

Andre++
-- 
There is no reason for any individual to have a computer in    | Andre Hoekstra
their home. (Ken Olson, Ex-President Digital Equipment, 1977)  | Enschede -- NL
Newsgroups: comp.lang.c,comp.lang.c++,comp.lang.misc
From: wieck@jwminhh.hanse.de (Jan Wieck)
Subject: Re: How to turn PC speaker off?
Organization: Private Site under Mach386
X-Newsreader: Tin 1.1 PL4
Date: Tue, 5 Jan 1993 23:19:23 GMT

cschang@hamlet.umd.edu (C. S. Chang) writes:
: Is there any way to turn the PC speaker off so that there will be no
: beeps if a certain function call failed.  I do not have access to this
: particular function call which beeps at failure.  So I am looking for
: a way to prevent the PC from generating some beeping noise.

Look into .../kernel/console.c function beep().

It is easy to implement a system-call, that enables or disables a flag
which is testet in beep(). If this call is only permittet to root, the
sound will be suppressed without any chance for the application to work
around.

Pardon to all C-programmers, that this answer is MINIX-specific :-)

Oh, you wanted a solution for PC-DOS? Well, also possible, cut the
wire (this is no joke - it's the only way under PC-DOS).


Until later, Jan

-- 
# Any language keeps its own misunderstandings; #
# why shouldn't programming languages do?       #
#                                               #
#            wieck@jwminhh.hanse.de (Jan Wieck) #
Newsgroups: comp.lang.c
From: jvigneau@cs.ulowell.edu (Joe Vigneau)
Subject: Clarifications...
Organization: Not Much
Distribution: comp
Date: Wed, 6 Jan 1993 21:51:43 GMT

/*	Sorry to waste bandwidth guys, but when you have a question
or comment, would you please state what compiler and OS you are using?
This would probably add additional information on the nature of the
problem/comment...
*/
--
jvigneau@cs.ulowell.edu-<All opinions are mine, not UMassLowell's>-Joe Vigneau
      "Picard & Riker in '96: Make it So for The Next Generation!"
Xref: sparky comp.lang.c:19190 comp.lang.perl:7661 comp.unix.programmer:5819 comp.sources.d:1510 comp.unix.questions:15150
From: faigin@aero.org (Daniel P. Faigin)
Newsgroups: comp.lang.c,comp.lang.perl,comp.unix.programmer,comp.sources.d,comp.unix.questions
Subject: C source code analysis tools
Date: 4 Jan 93 09:01:21
Organization: The Aerospace Corporation, El Segundo, CA
Distribution: comp
NNTP-Posting-Host: soldan.aero.org

[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"
Xref: sparky comp.lang.c:19547 comp.lang.c++:18958
From: cshaver@informix.com (Craig Shaver)
Newsgroups: comp.lang.c,comp.lang.c++
Subject: Re: C/C++ Speed
Date: 11 Jan 93 16:38:52 GMT
Distribution: usa
Organization: Informix Software, Inc.

In article <dak.726696239@tabaqui> dak@tabaqui.informatik.rwth-aachen.de (David Kastrup) writes:
>dliao@aludra.usc.edu (David Liao) writes:
>
.......
>>	I also heard the size of C++ program is generally bigger than C.
>>I am a C programmer trying to learn C++.  So, don't blame me if I have 
>>created any misconception about C++.
>
>For one minor detail: including printf/scanf can include more code than
>is actually used. An intelligent C++ linker will only get that parts
>of the stream library REALLY needed.
>

Who implements an intelligent C++ linker???  I was under the impression that 
you get all the functionality in a class when you link, whether you use it 
or not.  



-- 
Craig Shaver  (cshaver@informix.com for now) (415)390-0654 (415)926-6407
Productivity Group POB 60458 Sunnyvale, CA  94088
Xref: sparky comp.lang.c:19328 comp.os.vms:20460
From: nreadwin@micrognosis.co.uk (Neil Readwin)
Newsgroups: local.unix.help,comp.lang.c,comp.os.vms
Subject: Re: Using C to read Fortran Files
Date: 6 Jan 93 21:06:39 GMT
Organization: Micrognosis, a division of CSK(UK) Ltd

kaarts@ccu.umanitoba.ca (Kenneth John Aarts) writes:
|> [...]
|> >	write(1,10) 'cArt'
|> >10	format(a4)
|> [...]
|> >	fp=fopen("test","r");
|> >	fscanf(fp,"%c%c%c%c%c",&d1,&d2,&d3,&d4,&d5);
|> >	printf("%d %d %d %d %d\n",d1,d2,d3,d4,d5);
|> 
|> >The output of the C program is:
|> >  10  65  114  116   13
|> [...]
|> This is all done on VMS.  The fortran created file has a 'fortran carriage
|> control' record attribute.

Something (my guess would be the VAX C RTL) is carefully stripping out the
carraige control character ('c') and replacing it with what it thinks is the
appropriate carraige control (precede with LF and append CR). Indeed, if
you change the 'c' to say '1' or '-' then you will get a different result.

If you change the fopen() call to be:
	fp=fopen("test","r","ctx=nocvt");
then you will get the 'c'. However, note that '1' will still be converted to
form-feed. Gak!

This is VMS specific, so followups to comp.os.vms only please. Neil.
-- 
 Phone: +44 71 815 5283  E-mail: nreadwin@micrognosis.co.uk
 Anything is a cause for sorrow that my mind or body has made
From: Mike.Tedder@f181.n363.z1.fidonet.org (Mike Tedder)
Newsgroups: comp.lang.c
Subject: 3-D graphics
Date: Tue, 05 Jan 93 15:45:00 PDT
Organization: FidoNet node 1:363/181

I'm not exactly sure how to put this... but I'd appreciate any help if maybe one of you out there can help me...

What I'd like to do is create a new data type, called "object".  (C++ here, please)  Here's the best typedef I could come out with:

typedef struct
{
  int xcoord, ycoord, zcoord;
  int scale;
  int roll, pitch, yaw;
  ????? ????????;
  int active;
} object[999];

The ???? marks are what I'm not sure about.... I don't exactly know *HOW* to define the object in any of C++'s terms.  (I'd be using 256 color VGA)  And, after I *WAS* able to define the term, say "char *" or something, how would I draw the object on the screen, denoting whatever coordinate in space it was? (There would also be a 'camera' structure, like so:)

struct
{
  int xcoord, int ycoord ....
  ..
  ..
  int active;
} camera;

Now, finally, in my program, I could do something like this, very easily:

void main(void)
{
  camera.active=1;
  object[1]=loadobject("GRAPHIC.IMG");
  camera_follow_obj(1);  /* Say, maybe 10 units away from object on z axis,
                            and maybe 5 units away from object on y axis */
  object.active=1;
  object.xcoord=0; object.ycoord=0; object.zcoord=0;
  object_draw(1);
  object_moveto(10,10,10);
  ...
  ...
}

Any help?  Please?

--  
        Mike Tedder  -  via FidoNet Node: 1:363/42
             UUCP:  -  ...tarpit!tous!business!181!Mike.Tedder
             ARPA:  -  Mike.Tedder@f181.n363.z1.fidonet.org
Newsgroups: comp.lang.c
From: daniel@moonshine.osf.org (Daniel Dardailler)
Subject: Is that ansi ?
Organization: Open Software Foundation, Motif Team
Date: Fri, 8 Jan 1993 14:27:30 GMT

A compiler is reporting the following warning:

  "void * and function pointers are not convertible to each other"

when encountering:

	void * p = (void *) func ;   /* func of any kind */

Newsgroups: comp.lang.c
From: misar@rbg.informatik.th-darmstadt.de (walter misar)
Subject: Re: Followup on size of executables.
Date: Mon, 4 Jan 1993 11:21:44 GMT
Organization: TH Darmstadt

In article <93004.051358RVK@psuvm.psu.edu>, <RVK@psuvm.psu.edu> writes:
> Thanks to everyone who replied to my earlier posting. I
> feel, however, that I still need some more clarification.
> I was asked what do I mean by a "huge" executable. The
> phrase is perhaps inaccurate. I used it only in relative
> terms, as illustrated by the example below.
> 
> Consider the Hello, World example in assembly (for intel 486):
> 
> .MODEL small
> .STACK 100h
> .DATA
> CR EQU 13
> LF EQU 10
> EOS EQU '$'
> HelloMessage DB 'Hello, World',CR,LF,EOS
> ExitCode DB 0
> .CODE
> start:
> mov ax,@data
> mov ds,ax       ;set DS to point to the data segment
> mov ah,9        ;DOS print string function
> mov dx,OFFSET HelloMessage ;point to 'Hello World'
> int 21h         ;display 'Hello, World'
> mov ah,4ch      ;DOS terminate program function
> mov al,[ExitCode] ; Exit Code
> int 21h         ;terminate the program
> END start
> 
> 
> and consider the corresponding C fragment:
> 
> #include <stdio.h>
> int main() { printf("Hello, World\n"); return 0;}
[ some stuff deleted ]

Hm, I don't know about redirecting in MS-DOS, but C can't use int21 directly,
since stdout may be some different file (could be at least freopened() ).
If you're really concerned about size, why do you use the complex printf(),
when a simple puts() will do ? 
Further, I don't think that #inluding <stdio.h> will cause the linker to
add all functions prototyped therein, because the linklibraries aren't sorted
according to header-files (on most systems) but roughly in standart-functions,
math-functions and so on.
Additionally C has to do a lot of startup-work before invoking main(), which
adds to size too, like splitting the command line into args. After termination
of the program, the implementation may choose to close all remaining unclosed
files, or to free all memory malloced() but never freed(). All this convienience
is paid with space of course, but on normal developments the impact isn't
that great than on hello.c . 

-- 
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,comp.os.msdos.programmer
From: pdh@netcom.com (Phil Howard )
Subject: MSC 6.0 still available
Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
Date: Mon, 4 Jan 1993 08:13:12 GMT

I recall someone mentioning on one of these groups that they wanted a copy
of the previous version of MSC (6 instead of 7).  Well I was in a store
here today and noticed they had 2 copies of MSC 6.0 on the shelf.  There
was no MSC 7 around to be seen, either.
-- 
/************************************************************************\
| Phil Howard,  pdh@netcom.com,  KA9WGN    Spell protection?  "1(911)A1" |
| "It's not broken... it's just functionally challenged" --Phil and Pete |
\************************************************************************/
Newsgroups: local.unix.help,comp.lang.c,comp.os.vms
From: kaarts@ccu.umanitoba.ca (Kenneth John Aarts)
Subject: Using C to read Fortran Files---Solved
Organization: University of Manitoba, Winnipeg, Canada
Date: Thu, 7 Jan 1993 19:07:39 GMT

In <1993Jan7.030702.4174@dbased.nuo.dec.com> lionel@quark.enet.dec.com (Steve Lionel) writes:


>It is the VAX C Run-Time Library which is doing this to you; it "interprets"
>the FORTRAN carriage control, turning the leading "c" into an LF, as that's
>what would happen if you printed the line on a terminal or printer.  WHY
>it does this I don't know, nor do I know how to stop it, but I thought
>that at the least you should know where the problem is located.  

>All I can suggest is that, if possible, open the file from FORTRAN
>specifying CARRIAGECONTROL='LIST'.  I'll see what I can dig up about
>solutions from the VAX C end.

Thanks to the enormous number of people who emailed me advice.  The problem
is solved.  Changing the fopen statement to

	fp = fopen("name","r","ctx=nocvt");

solved my particular problems.  Who would have figured?  Thanks again,

Ken

(VAX C Run Time Library Ref. Man. , Table Ref-3.  This option tells it
to NOT convert fortran carriage control bytes.)
Newsgroups: comp.lang.c
From: raph@panache.demon.co.uk (Raphael mankin)
Subject: Re: Any hope for me..? 
Distribution: world
Organization: Solvfield Ltd.
Reply-To: raph@panache.demon.co.uk
X-Mailer: Simple NEWS 1.90 (ka9q DIS 1.19)
Date: Sun, 10 Jan 1993 21:51:20 +0000

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

>....
>I've been thinking about your preferences towards non CS graduates, but
>I still find it a remarkable opinion. Here in the Netherlands, people 
>with an degree in English or History (as you wrote) know next to nothing
>about computers, mathematics and computer science. 
>
>Are you actually telling us that, after you've employed those people,
>you're retraining them? Don't you think that doing so would be very
>cost ineffective. I estimate that it would take at least a year or so,
>before these people start being productive. 
>
You appear to have missed my point. What I said was 'when I employ 
_programmers_'. The implication is that they do know how to program. What I am 
looking for is people who know _more_ than programming; people who have been
educated, not just trained; well rounded individuals, not animated machines.

I could go on, but bandwidth ...
--------------
Raphael Mankin			Nil taurus excretum
Newsgroups: comp.lang.c
From: vpham@cs.ulowell.edu (vinh)
Subject: Where to include
Organization: University of Massachusetts at Lowell Computer Science
Date: Thu, 7 Jan 1993 23:53:22 GMT



fun()
{
}

#include <stdio.h>


fun2()
{
	printf("test...");
}

we argued at work about where to put stdio.h; obviously fun()
isn't calling anything declared in <stdio.h>, so  don't think
stdio.h should be included at the beginning of the file; my
co-fellow worker thinks it's ugly ; what do you think?
what does the standard say? what does K&R say?
From: jlothian@castle.ed.ac.uk (J Lothian)
Newsgroups: comp.lang.c
Subject: Re: Think C 4.0 and Debugger at System 7
Date: 4 Jan 93 15:20:50 GMT
Organization: Edinburgh University Computing Service

In article <1i8hojINNjp3@iskut.ucs.ubc.ca>, jungjk@unixg.ubc.ca (Jinki Jung) writes:
|> 
|> 	Hi,
|> 
|> 		I try to use Think C with Debugger function on. 
|> 	Every time I RUN a project, the screen get frozen in the middle of
|> 	processing. According to the manual, using Debugging function requires
|> 	at least 2MB of memory. I have total 4 MB of memory and use System 7.
|> 	I wander why this is so. 
|> 
|> 		If this is not good place to ask, I would appreciate if
|> 	anyone point me a proper newsgroup.
|> 
|>  	Jung JK (jungjk@unixg.ubc.ca) 
|> 
|> 	
|> 
|>   
Try booting your Mac with extensions off (restart while holding down
shift key). I had the same problem, and this worked for me.

James

-- 

-------------------------------------------------------
James Lothian        |      "It's life, Jim, 
james@uk.ac.ed.caad  |   but not as we know it"
Newsgroups: comp.lang.c
From: wieck@jwminhh.hanse.de (Jan Wieck)
Subject: Re: Fopening a text file
Organization: Private Site under Mach386
X-Newsreader: Tin 1.1 PL4
Date: Wed, 6 Jan 1993 23:45:58 GMT

mox@vpnet.chi.il.us (William Moxley) writes:
: I'm having some problems with a program that I wrote for this computer
: which is running a sys V unix operating system.  My problem is with
: fopen.  When I try do a fopen("filename", "rt"); it opens the file as a
: binary.  If I drop the t, is still creates a binary file.  So how do I
: make fopen create a straight text file?
:
: As you can guess, I normally don't write programs for machines other
: than dos.  Thanks in advance...

        Files under UNIX are different from that under DOS in the
        case  of  holding  ASCII-text. DOS (as a sibling of CP/M)
        encodes a new-line as CR, LF (or 0x0D, 0x0A in HEX). UNIX
        only says LF.

        This is one of the major reasons why C-programs cannot be
        100%  portable between UNIX, DOS and e.g. VMS (which also
        uses CR, LF).

        If your program uses fprintf(3S) and fgets(3S), it  would
        get  the  same  data  back  that it wrote. But if you use
        read(2) instead of fgets(3S), it possibly  wouldn't.  The
        standard   I/O-functions   library   (where  the  f...()-
        functions reside) is implemented under each  OS  in  that
        kind,  that  a  normal  cat- | type- | show-command would
        display a file, written  with  these  functions,  like  a
        standard text-file under this OS.

        For this reason, the standard under DOS is to map '\n' to
        0x0D,0x0A  and  vice  versa. But they wouldn't create the
        same binary data as C under UNIX would  do.  To  minimize
        port-overhead,  binary modes are added to these functions
        under DOS. Borland's  Turbo-C  also  makes  the  same  in
        read(2)  and  write(2),  so  you  have  to  use  the (TC-
        specific) mode switch O_BINARY to suppress  it  (I  don't
        know how other DOS compilers would do - I think similar).

        Back to you - what you read in  your  program  is  binary
        data as it is text. There's no difference under UNIX.


Until later, Jan

-- 
# Any language keeps its own misunderstandings; #
# why shouldn't programming languages do?       #
#                                               #
#            wieck@jwminhh.hanse.de (Jan Wieck) #
Newsgroups: comp.lang.c
From: hari@blackmail.eng.uiowa.edu (Hari Vattikota)
Subject: Re: Question on malloc
Date: Fri, 8 Jan 1993 15:54:12 GMT
Organization: Department of Elect. and Comp. Engr., University of Iowa, USA.

Continuation of article 107022

The command for compilation is "cc -g main.c trans.c" where main.c and trans.c
are the two files.I am including the header files stdio.h and fcntl.h.
Also no sbrk() is used in my code.I have these header files in declare.h file
and I include the declare.h file in both of my files.

When I try the same program on a Sun machine the error is of a different kind.
One of the global variable value gets corrupted.

Hari.

Newsgroups: comp.lang.c