Re: compile problem on older program
- Date: Sun, 29 Oct 2017 13:05:14 +0100
- From: <tomas@xxxxxxxxxx>
- Subject: Re: compile problem on older program
-----BEGIN PGP SIGNED MESSAGE-----
On Sun, Oct 29, 2017 at 11:53:22AM +0100, Thomas Schmitt wrote:
> tomas@xxxxxxxxxx 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();
Right. That's just the declaration...
> I found a quote in
> "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 :)
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
-----END PGP SIGNATURE-----