[HN Gopher] Turns out GCC has imperative argument handling
___________________________________________________________________
Turns out GCC has imperative argument handling
Author : ufo
Score : 19 points
Date : 2022-07-01 10:34 UTC (12 hours ago)
(HTM) web link (hisham.hm)
(TXT) w3m dump (hisham.hm)
| rayiner wrote:
| Pedant: That's not imperative. You can have a purely functional
| program that uses a flag in a list to treat subsequent arguments
| in a list differently. Just have a conditional on the flag, and
| recursively call "do_things_this_way" on one branch and
| "do_things_that_way" on the other.
| kccqzy wrote:
| Blame the linker, not GCC.
|
| Also it's pretty well known that the order of command line
| arguments passed to the linker is important. It is sometimes also
| needed to pass a library to the linker multiple times.
| jepler wrote:
| Yes, sort-of, though the "imperative" linker flags -( and -)
| may help you. if you can figure out how to quote them properly
| (or use --start-group / --end-group)
| klysm wrote:
| I did not know that but that does suck. The typical contract is
| that it shouldn't matter beyond being able to parse it.
| cstrahan wrote:
| I believe it _would_ be that way, if not for performance. The
| linker keeps track of unresolved symbols, and resolves those
| symbols while parsing subsequent object files. So if you list
| a dependency _before_ it is used, that dependency won't be
| linked at all, resulting in unresolved symbols -- thus the
| need for object files to be listed in a particular order.
|
| Edit: and the need for listing a dependency twice is to
| resolve mutually dependent object files. If A depends on
| symbols from B and B depends on symbols from A, you can link
| A,B,A or B,A,B (per the aforementioned reasoning).
| an1sotropy wrote:
| I'm guessing this person hasn't used (ImageMagick) "convert";
| AFAIK it is the program that does the most to turn a sequence of
| command-line arguments into an imperative scripting "language"
| touisteur wrote:
| You can built pretty darn complex things with just imagemagick
| command-line, between the max command line size and combining
| several intermediate pictures. I used to do complex dashboards,
| system architectural diagrams, with just bash functions calling
| in imagemagick. Now if you don't have imagemagick, rsvg-convert
| will do, just remember your svg :-).
| RedShift1 wrote:
| Would love to see some screenshots of that... Sounds like the
| digital equivalent of hand-drawn schematics
| touisteur wrote:
| Also I thought this crown of command-line as DSL was
| ffmpeg's?
| light_hue_1 wrote:
| Or ffmpeg.
| yjftsjthsd-h wrote:
| > I thought find was a strong contender for Unix command with the
| weirdest argument handling, but I guess gcc takes the cake.
|
| Depending on how you count, surely dd should take the cake?
| Otherwise, you're just including the _group_ of commands that
| uses arguments as a command language, and I don 't think that's
| actually such a small group; ffmpeg does the same thing, too.
___________________________________________________________________
(page generated 2022-07-01 23:00 UTC)