2

What is the reason for some gcc options to start with two dashes? Are single and double dash interchangeable? For example, https://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html lists -specs=file, but exit.c:(.text+0x18): undefined reference to `_exit' when using arm-none-eabi-gcc refers to --specs=nosys.specs.

Lundin
  • 195,001
  • 40
  • 254
  • 396
Paul Jurczak
  • 7,008
  • 3
  • 47
  • 72
  • 2
    Related: https://stackoverflow.com/questions/13899587/why-does-do-gcc-and-other-tools-not-follow-the-gnu-command-options-conventio – Ruud Helderman Jul 14 '22 at 13:28
  • 1
    The number of dashes is not optional, you need to use them as GCC wants them. The rule of thumb is: one dash for short options (one letter) and two for long options (words). However, asking for _reasons_ why some long options have only one dash is probably futile here. You might want to ask GCC's developers. – the busybee Jul 15 '22 at 07:42
  • @thebusybee I was hoping for interchangeability and backwards compatibility being the reason. Are you saying that `-specs=file` is incorrect? – Paul Jurczak Jul 17 '22 at 04:29
  • Why not just try each alternative? GCC will react accordingly. ;-) – the busybee Jul 17 '22 at 09:20
  • 1
    FWIW: I've just noticed my `--std=...` flag (with two hyphens) was accepted all right (despite `-std` being the documented form). – Sz. Jan 29 '23 at 21:58

0 Answers0