Please share your oppinion on anything you do not like in the C or C++
or Java syntax (they're quite similar).
In order to maintain the integrity of the discussion (have everything
at the same place) please respond on comp.lang.c.
Taking your post at face value, I'd like to see the ability to have a
sparse parameter list to a function, but this is kind of "out there".
You need first function with variable arguments and then a large
number of variable arguments and then a function that allows a large
number of arguments many of which aren't often needed, but might be
needed in any combination.
The API on an OS for which I write frequently has a function FIELINFO
with variable arguments, many of which you often don't need. If you
frequently need only either the file handle for the open file or a
filename for one that need not be open and these are the first two
nominal arguments. It would be cool not to have to count the damn
commas in the call:
FILEINFO (FNum,,,,,,,,, &rec_len); and instead to use a syntax like:
FILEINFO (fnum:FNum, lrecl:&rec_len); I picked colon because that is
how I think of it, we could just as eaily use accent grave or sharp or
dollar sign or even at sign
FILEINFO (fnum`FNum, lrecl`&rec_len);
FILEINFO (fnum$FNum, lrecl$&rec_len);
FILEINFO (fnum#FNum, lrecl#&rec_len);
FILEINFO (fnum@FNum, lrecl@&rec_len);
or even
FILEINFO (@fnum=FNum, @lrecl=&&rec_len);
using a colon seems most natural to me (equal sign would be more
natural, but things could get confusing in a hurry.)
By the way, yes there are better ways to design an API, like creating
an argument that specifies a list of the stuff that you want and an
argument into which to store the stuff that you want. In fact, that
idea was used for functions that were created later and which had more
values to return, but I will tell you that it is not any much easier
to use. Especially, if you only want 3 or 4 of the available pieces of
information returned.