Xref: utzoo comp.lang.c:12299 comp.sys.ibm.pc:18608 Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!ncar!tank!oddjob!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c,comp.sys.ibm.pc Subject: Re: Function declarations (was: MSC v5.1 Bug???) Message-ID: <13344@mimsy.UUCP> Date: 1 Sep 88 15:15:55 GMT References: <10102@genrad.UUCP> <11879@iuvax.cs.indiana.edu> <5680@rpp386.UUCP> <1275@mcgill-vision.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 29 In article <1275@mcgill-vision.UUCP> mouse@mcgill-vision.UUCP (der Mouse) writes: >... I *would* be surprised to find that there's anything wrong with >something like [compressed vertically] >foo() { ... { double glurf(char*,int); ... } } >static double glurf(char *s,int maxlen) { ... } 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 */ ... } -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris