4 ms·
It's allowed because it's in the spirit of C: both allowing and prohibiting it is almost equally easy, and it's also sometimes useful, so it's allowed. Now, the
by Joker_vD 2y ago
It's allowed because it's in the spirit of C: both allowing and prohibiting it is almost equally easy, and it's also sometimes useful, so it's allowed. Now, there is a way [0] to statically check whether self-referential value initialization is well-founded or not but... it's kinda tricky to do and so, again in the C's spirit, such diagnostics is not required.
[0] https://www.cl.cam.ac.uk/~jdy22/papers/a-right-to-left-type-system-for-mutually-recursive-value-definitions.pdf https://www.cl.cam.ac.uk/~jdy22/papers/a-right-to-left-type-...