-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sun, Oct 29, 2017 at 11:53:22AM +0100, Thomas Schmitt wrote: > Hi, > > to...@tuxteam.de wrote: > > https://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html > > But my example code has no nested functions. > The two functions are disjoint. The main() function only contains > a type declaration by function prototype, not the function body. > > I can change the code to plain K&R C and gcc still fails: > > static int bla(x) > int x; > { > return (x != 1); > } > int main() > { > static int bla(); > return(bla(0)); > }
Right. That's just the declaration... > I found a quote in > > https://stackoverflow.com/questions/22904848/what-is-c-local-function-declaration-mechanism > "The C standard contains the following. n1570/S6.7.1/7: > The declaration of an identifier for a function that has block scope > shall have no explicit storage-class specifier other than extern." > > > I have N1548, which bears the same statement in 6.7.1 as subparagraph 6. > This paragraph refers to "typedef", "extern", "static", "_Thread_local", > "auto", and "register". > A declaration within a function body has block scope, indeed. > (6.2.1 subparagraph 4.) > > So gcc is right when it refuses on "static". The obviousily once existing > tolerance was inappropriate. > I still wonder whether the forbidden storage classes would cause semantic > problems, or whether they shall stay reserved for future use. Yep. Thanks for the clarification (or should it be declarification? ;-) > Have a nice day :) Same :) - -- t -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAln1w/oACgkQBcgs9XrR2kYuGwCffsamovEFf2JCN2Nh1wSKAfta nVYAnRBfCxVCkTzRNYcGSrTKoAlINSeT =2dKo -----END PGP SIGNATURE-----