Linuxtrent: Re: freebsd Vs Linux

  • From: Daniele Nicolodi <daniele@xxxxxxxxxx>
  • To: linuxtrent@xxxxxxxxxxxxxxxxx
  • Date: Tue, 6 Feb 2001 14:38:51 +0100

On Tue, Feb 06, 2001 at 02:20:17PM +0100, Flavio Stanchina wrote:
> 
> Hello aZaZel,
> 
> > Si ma i test non mi sembrano gran cosa, quello della cgi in in c ad
> > esempio.... [...]
> > non verrà ottimizzato dal gcc? Visto che perdipiù la variabile y non
> > viene più utilizzata....
> 
> Se non compili con -O, si fa tutti i conti anche se non servono a niente.

???

Non mi sembra:

main()
{
        int x;
        long y;
        y = 28.2839281;
        x = 339829;
        y = x / y;
}
                                        
gcc -S -O prova.c

        .file   "prova.c"
        .version        "01.01"
gcc2_compiled.:
.text
        .align 4
.globl main
        .type    main,@function
main:
        pushl %ebp
        movl %esp,%ebp
        leave
        ret
.Lfe1:
       .size    main,.Lfe1-main
       .ident  "GCC: (GNU) 2.95.2 20000220 (Debian GNU/Linux)"

Invece con:

main()
{
        int x;
        long y;
        y = 28.2839281;
        x = 339829;
        y = x / y;
        printf("%d", y);
}

gcc -S -O prova.c

        .file   "prova.c"
        .version        "01.01"
gcc2_compiled.:
.section        .rodata
.LC0:
        .string "%d"
.text
        .align 4
.globl main
        .type    main,@function
main:
        pushl %ebp
        movl %esp,%ebp
        subl $8,%esp
        addl $-8,%esp
        pushl $12136
        pushl $.LC0
        call printf
        leave
        ret
.Lfe1:
        .size    main,.Lfe1-main
        .ident  "GCC: (GNU) 2.95.2 20000220 (Debian GNU/Linux)"




Ciao
-- 
Daniele
                    --- http://www.grinta.net ---

-- 
Per iscriversi  (o disiscriversi), basta spedire un  messaggio con SOGGETTO
"subscribe" (o "unsubscribe") a mailto:linuxtrent-request@xxxxxxxxxxxxxxxxx


Other related posts: