Function declarations (was: MSC v5.1 Bug???)

T. William Wells bill at proxftl.UUCP
Sat Sep 3 16:19:06 AEST 1988


In article <13344 at mimsy.UUCP> chris at mimsy.UUCP (Chris Torek) writes:
: Surprise!
:
: According to the dpANS, the first declaration of a static function must
: label that function as static.  Now we also know (from the discussion
: chain in the references: line) that function declarations within other
: functions may not be labelled `static'.  Putting these together, the
: *only* legal ways to write this are:
:
:       static double glurf(char *, int);
:       foo() { ... /* call glurf */ ... }
:       static double glurf(char *s, int maxlen) { ... }
:
: or
:
:       static double glurf(char *s, int maxlen) { ... }
:       foo() { ... /* call glurf */ ... }

Yes. Shriek! Scream! Shout! Curse! Puke! etc.................................

All in the name of easing a few implementers' lives.

Shame on you X3J11.

---

To change the subject slightly: a new hire was asking me if he
could use some macros to encapsulate some flag setting.

I told him no.

Why?

Because the only purpose of the macro was to decrease the number
of keystrokes *he* had to use.  But it would have made the next
reader of the code have to understand two different things, the
macro AND the flag, to understand the code, instead of one.

He asked me why.  I said: this code will be written once and read
many hundred times.  Whose job do you think ought to be made
easier: yours or that future reader (who may be yourself, several
times)?  He got the point.

How is this relevant, you might ask?

Well, consider the related question: who should have to deal with
the pain caused by systems that make one pass compilation
difficult: every user of ANSI C, or those people charged with the
writing of a C compiler for those systems?

It seems that the committee forgot this.

For shame!

(And yes, even though I think the committee has done a generally
good job, I will take every opportunity to condemn them for this
egregious lapse.)

---
Bill
novavax!proxftl!bill



More information about the Comp.lang.c mailing list