What are the positive and negative forms of a command line option in Linux

Viewed 226

I am new to Linux. I am trying to compile and execute a c++ file. When I read the gcc manual, I found something in the manual that I don't understand:

Many options have long names starting with -f or with -W---for example, -fmove-loop-invariants, -Wformat and so on. Most of these have both positive and negative forms; the negative form of -ffoo is -fno-foo. This manual documents only one of these two forms, whichever one is not the default.

Can someone please explain what are the positive and negative forms of a command line option?

1 Answers

The positive form of the option enables some feature of the compiler, the negative form disables that feature.

For instance, -fmove-loop-invariants enables this optimization setting. To disable it, use -fno-move-loop-invariants.

Having both forms is useful so that you can override an option that might have been set using a default set of options in a build script or makefile. Also, some options enable or disable groups of settings at once, you can then use a later, more specific option to undo parts of this.

And sometimes you might use an option that's the same as the default, just to make your intentions explicit.

Related