I made an Executable using GCC

$ gcc Q1.c -save-temps -std=c89 -o Q1
$ size Q1
text       data     bss     dec     hex filename
1509        264       8    1781     6f5 Q1

and then i do this

$ gcc Q1.c -save-temps -std=c99 -o Q1
$ size Q1
text       data     bss     dec     hex filename
1544        264       8    1816     718 Q1

What might have caused a differrence in the text size of the program, what could be the possible reasons?

有帮助吗?

解决方案

There is no specific reason. Maybe different optimizations due to stricter standard. On my computer:

-> % gcc test.c -save-temps -std=c89
-> % size a.out 
   text    data     bss     dec     hex filename
   1093     568       8    1669     685 a.out
-> % gcc test.c -save-temps -std=c99 
-> % size a.out                     
   text    data     bss     dec     hex filename
   1093     568       8    1669     685 a.out

This is highly empirical. Maybe using -O flags even changes the results.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top