Re: compile problem on older program
- Date: Sun, 29 Oct 2017 11:53:22 +0100
- From: "Thomas Schmitt" <scdbackup@xxxxxxx>
- Subject: Re: compile problem on older program
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)
return (x != 1);
static int bla();
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.
Have a nice day :)