Earlier quoted context omitted.
The reason strcat, strcpy have the destination first is because of the need to support a variable number of arguments. By definition, if the number of arguments is variable, they must be at the end. So if you think of sprintf for instance, the destination has to be first. Now, to be consistent, strcat has to behave the same and have the destination first as well, although it doesn't have a variable number of argument…
I'm pretty sure strcpy et al pre-date the introduction of varargs. Besides, there's no reason the format string couldn't be the last argument of printf, except the specific technical detail that C requires at least one mandatory argument in any variadic function (the variable's address is used to locate the optional arguments in the stack.)
I always forget the argument order of the `ln -s` command
81–90 of 127 posts
Re: I always forget the argument order of the `ln -s` command
#82You start with "ln -s A B" and realize you always make the mistake, so you force yourself to do the opposite of your natural instinct: "ln -s B A". It works until this becomes natural but you still think you always get it wrong, so start doing the opposite of your new natural: "ln -s A B". You'll now be very confused until you force yourself to learn it for good.
This happens to me all the time for various binary things.
Re: I always forget the argument order of the `ln -s` command
#83from to
source target
Re: I always forget the argument order of the `ln -s` command
#84I'm thinking like an IDE will pop up some help text when you begin typing a function name or a recognised special word. Why doesn't the standard sh (bash for me) give me similar help, as I type "ln" it could give me a pop-up with the possible completions and then as I get to "ln -s" it could remind me with "TARGET [NAME] // will create a file named NAME that is a soft link to TARGET, or use TARGET's name if NAME isn't specified". You get the picture.
In a pure text env the help could appear on the next line highlighted appropriately or could be to the right of the cursor or somesuch.
I'm hoping someone will say $CONSOLE does that already ...? Anyone?
Re: I always forget the argument order of the `ln -s` command
#85(not "from"/"to", which is ambiguous)
Re: I always forget the argument order of the `ln -s` command
#86It's kind of a dumb way to think of it, but it seems to work for me.
Re: I always forget the argument order of the `ln -s` command
#87The way I remember it is "ln -s target [filename]", where filename is an optional argument to override the default, where the default is a link created in the CWD pointing to target. Easy.
Re: I always forget the argument order of the `ln -s` command
#88I used to have this problem. Then I realized that if I want to really copy a file, I type $cp file_from file_to and that $ln -s link_from link_to has a very similar effect to the cp command above. I haven't messed this up ever since.
In my experience the more variable argument often comes last, presumably for easy reuse. For example... $chown user1 file1 $chown user1 file2 $ln -s file1 file2 $ln -s file1 file3 ...seems more likely than... $chown user1 file1 $chown user2 file1 $ln -s file1 file2 $ln -s file3 file2
Re: I always forget the argument order of the `ln -s` command
#89Earlier quoted context omitted.
Which is really the odd ball. In a left-to-right language, it's sort of bizarre that we don't write `4 = x' since the rvalue tends to be the more complicated part of the expression. The curious bit is, AT&T assembly syntax does follow this convention so you'll see something like `mov $5, ax'.
Indeed. Assignment should really look like something like this this: expression -> variable;
expression memory-location !
to store and memory-location @
to read.