Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c    |    Meh, in C you gotta define EVERYTHING    |    243,242 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 241,540 of 243,242    |
|    bart to David Brown    |
|    Re: New and improved version of cdecl    |
|    27 Oct 25 17:44:33    |
      From: bc@freeuk.com              On 27/10/2025 16:35, David Brown wrote:       > On 27/10/2025 12:22, bart wrote:              >> Where did I say anything about my own house?       >>       >       > In the analogy, that would your own language, and/or your own       > declaration syntax that has nothing to do with C              It is C syntax flattened to LTR form, with modifiers all moved to the       basetype, and shared by all variables declared. Function return types go       after the parameter list.              However, this will clash with existing C syntax and created ambiguities.       So I suggested using, for example, the same keyword for a leading "*"       /as is used in Algol68/; not my language, even if I borrowed it myself       from there.              >> If my scheme was actually added and become popular, the old one could       >> eventually be deprecated.       >       > Is that your "plan" ?              I don't have a plan. It was an idea for allowing a modern, saner syntax       on top of C.              >> And yes it does 'fix' it by not requiring the use of tools like CDECL       >> when writing new code: type-specs are already in LTR, more English-       >> like form.       >       > Most C programmers don't need cdecl. The only people that do need it,       > either have very little knowledge and experience of C, or are faced with       > code written by sadists (unfortunately that is not as rare as it should       > be). Some others might occasionally find such a tool /useful/, but       > finding it useful is not "needing". And with your bizarre syntax              /My syntax/ (as in my proposal) is bizarre, but actual C type syntax isn't?!              The latter is possibly the worst-designed feature of any programming       language ever, certainly of any mainstream language. This is the syntax       for a pointer to an unbounded array of function pointers that return a       pointer to int:               int *(*(*)[])()              This, is not bizarre?! Even somebody reading has to figure out which *       corresponds to which 'pointer to', and where the name might go if using       it to declare a variable.              In the LTR syntax I suggested, it would be:               ref[]ref func()ref int              The variable name goes on the right. For declaring three such variables,       it would be:               ref[]ref func()ref int a, b, c              Meanwhile, in C as it is, it would need to be something like this:               int *(*(*a)[])(), *(*(*b)[])(), *(*(*c)[])()              Or you have to use a workaround and create a named alias for the type       (what would you call it?):               typedef int *(*(*T)[])();               T a, b, c;              It's a fucking joke. And yes, I needed to use a tool to get that first       'int *(*(*)[])()', otherwise I can spend forever in a trial and error       process of figuring where all those brackets and asterisks go.              THIS IS WHY such tools are necessary, because the language syntax as it       is is not fit for purpose.              > So you have set up a straw man, claimed to "fix" this imaginary problem,       > while actually doing nothing of the sort.              So what imaginary problem does CDECL fix? There's a reason it uses the       word 'gibberish'. (I'm not even going into stuff like 'long const long       unsigned'.)                     > And even if your syntax was as great as you think (IMHO it is nicer in       > some ways, worse in others              In which ways?              > - and I think most C programmers would agree       > on that while not being able to agree on which parts are nicer or       > worse), you still haven't shown the slightest concept of your claimed       > "plan" to implement it.              What needs to be implemented? It would take some hours to add to my C       compiler. Maybe it needs tweaks to fix things I hadn't forseen. But I       can't see there is much problem.              Getting anyone else (who are going to have the same attitudes as yours)       to agree to it, and starting a process to add it to the language, is the       big obstacle.              But technically there is little to it.              > Yes, my ideal would be different from the output of cdecl. No, the       > author is not doing something "wrong". I live in a world where       > programming languages are used by more than one person, and those people       > can have different opinions.              Find me one person who doesn't think that syntax like int *(*(*)[])()       is a complete joke.              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca