5 ms·
Clang, swiftc, etc. would like a word with you... :) (It bothers me too.)
by jonpalmisc 4y ago
Clang, swiftc, etc. would like a word with you... :)
(It bothers me too.)
- sp332 4y ago-fpic is a single letter option, -f, followed by the parameter pic. Clang still uses two hyphens for long options including --help.
- lifthrasiir 4y agoThere are tons of options that start with -f and can't be decomposed in that way [1, e.g. -framework]. They are essentially atomic options with a loose naming convention. [1] https://clang.llvm.org/docs/ClangCommandLineReference.html https://clang.llvm.org/docs/ClangCommandLineReference.html
- IgorPartola 4y agoCorrect. You cannot use “ramework” as an argument to “-f”. Instead use two dashes and it is unambiguous.
- lifthrasiir 4y agoIt took me some thoughts to realize what you wanted to say, and you are incorrect: there is no single option `-f` in cc options! `-f` is just a common prefix of hundreds of independent options, like `-fsanitize=...` (which can't be used as `-f sanitize=...`). As I've iterated before, those prefixes mostly represent broad categories of options and not hard and fast rules: `-g` for debug, `-i` for directories, `-m` for target architectures, `-W` for warnings, and `-f` for virtually everything else.
- deleted 4y ago[deleted]
- hsbauauvhabzb 4y agoBut maybe we should talk about the lack of space character between the flag and the argument…
- account42 4y agoThat's just how short options with arguments work in getopt POSIX land: '-oARG' is equivalent to '-o' 'ARG' just like '--option=ARG' is equivalent to '--option' 'ARG' (for GNU long options). This means that you cannot chain any other short options after one with an (optional) argument but otherwise does not cause any problems.
- hsbauauvhabzb 4y agoYes not every Linux/unix arg parser conforms to posix, some require a space, others do not.
- smaudet 4y agosaneclang, saneswift, (sanegcc?) cli wrappers around clang, swift which fix the insane porcelains of those toolchains. We built a million GUIs for these, why did we never build CLIs for bad CLIs?
- account42 4y agoTo be fair to Clang, the -arguments are inherited from GCC for compatibility (which perhaps inherited them from other CCs) and then extended from there in the most consistent way possible. Similarily, clang-cl supports cl.exe-style flags for drop-in compatibility.