October 22, 2024
Chicago 12, Melborne City, USA
C#

Difference between Microsoft compiler and GNU compiler, in terms of output executable file size


Suppose I have the following program:

#include <stdio.h>
int main()
{
    printf("This is a sample C program.\n");
    return 0;
}

If I compile it with the Microsoft compiler (cl.exe /O1 sample.c) on a Windows 7 32-bit machine, then it outputs an executable file that is 44 KB.

If I compile it with the GNU compiler (gcc sample.c) on a CentOS 64-bit machine, then it outputs an executable file that is 6 KB.

Generally speaking, why is there such a big difference in file size for this small program? Why does it take Windows 44 KB just to print a line and exit?



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video