korsberg@abaa.uucp (Ed Korsberg) (11/16/90)
I am looking for the source code to a program called cdelc This program apparently is used by many people out in netland and will translate an English description of a C variable into the C-style variable. For example cdecl> x is an pointer to an array of 10 pointers to functions that return int results in int (*(*x)[10])(); If anyone has the source code to this would you please either e-mail it to me or tell me where I can get it via ftp. I do not have access to ftp but the high priest of our computer center does. I would prefer to have the source code mailed to me directly, but could also appeal to our computer center for help (fill out form, kiss feet, ...). Thanks in advance for any cooperation. -------------------------------------------------------------------------------- Ed Korsberg E-mail: korsberg@aa.ab.com Allen Bradley Inc. phone: 313-998-2470 555 Briarwood Circle Ann Arbor, Mich 48104 -- Ed Korsberg E-mail: korsberg@aa.ab.com Allen Bradley Inc. phone: 313-998-2470 555 Briarwood Circle Ann Arbor, Mich 48104
conor@lion.inmos.co.uk (Conor O'Neill) (11/22/90)
In article <5656@abaa.UUCP> korsberg@abaa.UUCP (Ed Korsberg) writes: >I am looking for the source code to a program called cdelc >This program apparently is used by many people out in netland and will >translate an English description of a C variable into the C-style >variable. For example > >cdecl> x is an pointer to an array of 10 pointers to functions that return int >results in > int (*(*x)[10])(); Doesn't anybody else see the irony of needing a program to write C declaration syntax? And some people teach this language to beginners.... --- Conor O'Neill, Software Group, INMOS Ltd., UK. UK: conor@inmos.co.uk US: conor@inmos.com "It's state-of-the-art" "But it doesn't work!" "That is the state-of-the-art".
andy@research.canon.oz.au (Andy Newman) (11/23/90)
In article <12671@ganymede.inmos.co.uk> conor@inmos.co.uk (Conor O'Neill) writes: > >Doesn't anybody else see the irony of needing a program to write >C declaration syntax? > >And some people teach this language to beginners.... > I agree that C isn't the language with which to teach programming but ... It was a fairly complex type (pointer to an array of 10 pointers to functions that return int) in a single declaration. Try the same thing in another language, looks just as bad (and just as confusing for the beginner). The thing is don't do so much in one declaration. Now if it were Occam there wouldn't be a problem...you can't do it at all ;-) -- Andrew Newman, Software Engineer. | Net: andy@research.canon.oz.au Canon Information Systems Research Australia | Phone: +1 61 2 805 2914 P.O. Box 313 North Ryde, NSW, Australia 2113 | Fax: +1 61 2 805 2929
gwyn@smoke.brl.mil (Doug Gwyn) (11/24/90)
In article <12671@ganymede.inmos.co.uk> conor@inmos.co.uk (Conor O'Neill) writes: >Doesn't anybody else see the irony of needing a program to write >C declaration syntax? "cdecl" actually translates the other way around, but... >And some people teach this language to beginners.... While I don't think that C is a good choice for a first programming language, C declarations are not hard to code if one has learned C properly. For one thing, typedefs can always be used to make the nesting easy to handle. The conceptual complexity of "pointer to arrays of pointers to functions taking structures containing ..." is the same no matter what syntax is used to declare it; such types are sufficiently complex that the mind can't take in all the aspects at once, but must analyze it in steps. Properly selected typedefs can materially assist in that analysis.
loel@bluemoon.uucp (Loel Larzelere) (11/25/90)
conor@lion.inmos.co.uk (Conor O'Neill) writes: > Doesn't anybody else see the irony of needing a program to write > C declaration syntax? > > And some people teach this language to beginners.... And I was told (when I haul my hiney off to the local community college to take programming classes) to only bother with C and Assembler, and forget about basic, cobol etc. I was also told to try and learn C on my own, as what would be taught would be about 5 years beind the times. Go figure. ~~\ Loel /~~ -- loel@bluemoon.uucp ...osu-cis!n8emr!bluemoon!loel or ...towers!bluemoon!loel "I just want to be remembered for two simple words -- -- Any two as long as they are simple."
martin@mwtech.UUCP (Martin Weitzel) (11/26/90)
In article <12671@ganymede.inmos.co.uk> conor@inmos.co.uk (Conor O'Neill) writes: >In article <5656@abaa.UUCP> korsberg@abaa.UUCP (Ed Korsberg) writes: >>I am looking for the source code to a program [ to ] >>translate an English description of a C variable into the C-style >>variable. For example [...] >> int (*(*x)[10])(); >Doesn't anybody else see the irony of needing a program to write >C declaration syntax? > >And some people teach this language to beginners.... I don't quite understand this. What really *is* a problem teaching C to beginners is that it may be difficult to explain the concept of pointers to functions (oh well, ever teached those `senior programmers' who were doing their `professional work' with BASIC for ten years or more an to whom you can't explain *anything* if you can't show how this can be done in BASIC). But if you mean the syntax: I've never ever had difficulties to explain the C syntax to beginners, provided they had understood the concepts of pointers, arrays, and functions. Probably there are many teachers out there, who still have difficulties understanding the syntax. It is more or less human that many of those teachers try to hide their own problems by using a program as "cdecl" to prepare their questions and check the answers of their students. I've too sometimes given "cdecl" to my students, but not before I was sure that they used it only to re-check the answers they figured out *without* using it. BTW: It would be nice to have a "cdecl" program with a buildtin "quiz-mode". Such a program should randomly generate questions (either in C syntax or in verbose description of the desired type) and then accept answers (for the beginner in multiple choice style). I'm sure, a student playing half an hour with such a program will never ever need to use "cdecl" for real programming tasks. -- Martin Weitzel, email: martin@mwtech.UUCP, voice: 49-(0)6151-6 56 83