indirect reference/use of procedures
Tony Sanders
sanders at sanders.austin.ibm.com
Tue Mar 20 06:44:56 AEST 1990
In article <A392C67xds13 at ficc.uu.net> peter at ficc.uu.net (Peter da Silva) writes:
-> void (* myfunc)();
-> myfunc ();
-
-I realise this is a valid syntax as of X3J11 (or whatever it is now that
-it's complete), but it's confusing. If nothing else, it breaks the symmetry
-between usage and declaration. C declaration syntax is confusing enough
-as it is, and declarations of pointers to functions particularly so. It's
-better to blow the extra three characters and call "(* myfunc) ();".
I agree on the point that usage and declaration should agree. I'm 100%
supportive of using "(*myfunc)();". I used "myfunc()" a few times in
the past and it's confusing when trying to debug that code. I keep
looking for a function named "myfunc" and sometimes it can take a few
minutes to realize what I've done, I then convert the code before it
does anymore damage (don't you just hate old code :-).
-What did the committee have in mind when they decided to make this syntax
-part of the standard?
I suspect since it was already being used both ways, they simply decided
not to break existing code (which maybe wouldn't have been such a bad idea).
I just hope they clearly advocate the usage of "(*myfunc)()" in the standard.
-- sanders The 11th commandment: "Thou shalt use lint"
For every message of the day, a new improved message will arise to overcome it.
Reply-To: cs.utexas.edu!ibmaus!auschs!sanders.austin.ibm.com!sanders (ugh!)
More information about the Comp.lang.c
mailing list