33

Most UNIX C compilers link executables by default to a file called "a.out". Why? Is this a written standard or just de-facto standard behavior? What would break if these compilers would just produce an error message (or use a different default name) instead of producing "a.out"?

Ville Laurikari
  • 28,380
  • 7
  • 60
  • 55

2 Answers2

46

a.out stands for assembler output.
I think that justifies why most compilers have this name as default. More info here.

sud03r
  • 19,109
  • 16
  • 77
  • 96
8

A.out is actually the name of an UNIX executable file format. (ELF is another)

The compiler produces that name (by tradition) if you don't give your executable a name explicitly.

What would break if these compilers would just error out instead of producing "a.out"?

Nothing would break, but what do you mean by 'error out'? Do you mean, refuse to compile unless an executable name is supplied to the linker ?

David-SkyMesh
  • 5,041
  • 1
  • 31
  • 38
  • 1
    We never know if it won't break something. There might still be some tools that depend on this fact of automatically generated filenames for the resulting executable. Most of the *modern* tools don't, though. – BarbaraKwarc Jul 01 '18 at 04:35