Liste des Groupes | Revenir à cl c |
David Brown <david.brown@hesbynett.no> wrote:Prior to C23 you could have non-trivial expressions for initialisations that depend on the order of the declarations in the code:On 01/12/2024 17:57, Michael S wrote:Michael probably meant 'constexpr'. AFAICS the are on troubles withOn Sun, 1 Dec 2024 15:34:04 +0100>
David Brown <david.brown@hesbynett.no> wrote:>>
I can see some advantages in a language being happy with any order of
function definition, without requiring forward declarations to use a
function before it is defined. But C is not like that, and I cannot
honestly say it bothers me one way or the other. And apparently, it
does not particularly bother many people - there is, I think, no
serious impediment or backwards compatibility issue that would
prevent C being changed in this way. Yet no one has felt the need
for it - at least not strongly enough to fight for it going in the
standard or being a common compiler extension.
>
>
>
I think, arguing in favor of such change would be easier on top of
the changes made in C23.
Before C23 there were, as you put it "no serious impediment or
backwards compatibility issue". After C23 we could more categorical
claim that there are no new issues.
>
Does that mean there was something that you think was allowed in C
before C23, but not after C23, that would potentially be a problem here?
>
What, specifically, are you thinking of?
automatic reordering of "pure" declarations. But variable declarations
may have initialization and 'constexpr' allows not entirely trivial
expressions for initialization. And C wants to be compatible with
C++, where even now initialization is much more "interesting".
So, reordering variable declarations is problematic due to
initalization and it would be ugly to have special case for
function declarations.
Les messages affichés proviennent d'usenet.