From: Jason Collins Newsgroups: comp.os.msdos.djgpp Subject: Large .exe size Date: Fri, 28 Feb 1997 16:54:37 +1100 Organization: Internet Image Lines: 277 Message-ID: <3316731C.2CEE@iimage.com.au> Reply-To: jason AT iimage DOT com DOT au NNTP-Posting-Host: c25mc1-asy7.newcastle.edu.au Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----------388EFD4D1E0" To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp ------------388EFD4D1E0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Hi all, I have only recently installed djgpp (v2) and decided to port an existing (very simple) graphics program to gcc using allegro 2.2. Everything went very smoothly, however when I compiled using gcc, the executable was 269kb compared to 24kb using Turbo C and my own pixel, line etc functions. I have included my source code (only short) and would appreciate help from anyone who could explain why this occured. Thanks --------------------------------------------------------------------------------- #include #include #include void initialise(void) { vline(screen,0,0,199,12); hline(screen,0,0,319,12); vline(screen,319,0,199,12); hline(screen,0,199,319,12); hline(screen,160,190,160+29,7); } void main(void) { int paddle=160; char c; int dx=1, dy=1; int x=160; int y=100; allegro_init(); set_gfx_mode(GFX_VGA,320,200,0,0); initialise(); do { if (kbhit()) { hline(screen,paddle,190,paddle+29,0); c = getch(); switch (c) { case ('a'): { paddle-=5; if (paddle<=1) {paddle=1;} break; } case ('s'): { paddle+=5; if (paddle>=289) {paddle=289;} break; } } hline(screen,paddle,190,paddle+29,7); } putpixel(screen,x,y,7); delay(10); putpixel(screen,x,y,0); x+=dx; if (x==318) dx=-1; if (x==1) dx=1; y+=dy; if (y==189 && x>=paddle && paddle>(x-30)) {dy=-1;} if (y==198) dy=-1; if (y==1) dy=1; } while (c != 27); exit(0); } ----------------------------------------------------------------------------- Jason Collins http://www.iimage.com.au Internet Image Pty Ltd email:jason AT iimage DOT com DOT au ------------388EFD4D1E0 Content-Transfer-Encoding: 7bit Content-Type: text/html; charset=us-ascii
Hi all,
 
I have only recently installed djgpp (v2) and decided to port an existing (very simple) graphics program to gcc using allegro 2.2.  Everything went very smoothly, however when I compiled using gcc, the executable was 269kb compared to 24kb using Turbo C and my own pixel, line etc functions.  I have included my source code (only short) and would appreciate help from anyone who could explain why this occured.
 
Thanks
 
---------------------------------------------------------------------------------
 
#include <stdio.h>
#include <dos.h>
#include <allegro.h>
 
void initialise(void) {
    vline(screen,0,0,199,12);     
    hline(screen,0,0,319,12);     
    vline(screen,319,0,199,12);     
    hline(screen,0,199,319,12);     
    hline(screen,160,190,160+29,7);
}
 
void main(void) {
 
    int paddle=160;     
    char c;
    int dx=1, dy=1;
    int x=160;     
    int y=100;
 
    allegro_init();     
    set_gfx_mode(GFX_VGA,320,200,0,0);     
    initialise();
 
    do {
        if (kbhit()) {             
            hline(screen,paddle,190,paddle+29,0);             
            c = getch();             
            switch (c)             
                {  case ('a'): {
                                    paddle-=5;                         
                                    if (paddle<=1) {paddle=1;}                         
                                    break;
                                    }                
                    case ('s'): {                         
                                    paddle+=5;                         
                                    if (paddle>=289) {paddle=289;}                         
                                    break;                         
                                    }                 
                    }                 
 
            hline(screen,paddle,190,paddle+29,7);                 
            }
 
            putpixel(screen,x,y,7);
            delay(10);                 
            putpixel(screen,x,y,0);                 
 
            x+=dx;                 
            if (x==318) dx=-1;                 
            if (x==1) dx=1;                 
 
            y+=dy;                 
            if (y==189 && x>=paddle && paddle>(x-30)) {dy=-1;}
            if (y==198) dy=-1;                 
            if (y==1) dy=1;
 
    } while (c != 27);
 exit(0); 
 

----------------------------------------------------------------------------- 

 
Jason Collins                        http://www.iimage.com.au
Internet Image Pty Ltd          email:jason AT iimage DOT com DOT au
 
------------388EFD4D1E0--