sixty4bit
sixty4bit

Reputation: 7956

`man cc`: no info about -Wall and -g flags (Learn C the Hard Way)

I am on exercise 2 of "Learn C the Hard Way. One of the extra credit challenges is:

Read man cc to find out more information on what the flags -Wall and -g do.

I am on OSX and used man cc to open the manual page but it doesn't have any info about -Wall or -g. However, I logged into a machine running Ubuntu and found a much larger manual page for cc that did include the information.

Why are the manual pages for OSX (Darwin?) and Ubuntu different? I obviously don't know anything about this stuff but I would've assumed that the manual pages would come packaged with the software and thus be the same no matter where the software was installed.

Upvotes: 2

Views: 194

Answers (2)

Jean-Baptiste Yunès
Jean-Baptiste Yunès

Reputation: 36431

Compilers *nix manual pages now only gives you the very basics. There is too many controls in a compiler chain to give you all of them in manual pages. Even --help option will not give you all controls. clang --help (on OSX) gives you about 350 lines, but the single list of clang warnings controls are about 450... It is difficult to count the number of options a compiler offers you, but probably thousands...

For such a tool, I encourage you to have a look at the online manuals.

Why different? Because compiler chains are dependent on Architecture/OS/ABI/Assembly/Linker, etc. So the same compiler (gcc for example) can behave differently on different platform; manuals should be different. Anyway, -Wall and -g are very common and basic, I am surprised that Wall don't appear in OSX manual...

Upvotes: 3

Bill Lynch
Bill Lynch

Reputation: 81986

It's likely that your OS X installation is using a compiler named clang and your Linux installation is using a compiler named gcc.

Therefore the man pages on OS X are probably written by the clang team and the man pages on your Linux installation are probably written by the gcc team.

These two compilers generally accept the same command line arguments though.

Upvotes: 3

Related Questions