Skip to content

Mixing declarations and statements is C11#11052

Merged
xavierleroy merged 1 commit intoocaml:trunkfrom
gadmm:mix_decl
Feb 23, 2022
Merged

Mixing declarations and statements is C11#11052
xavierleroy merged 1 commit intoocaml:trunkfrom
gadmm:mix_decl

Conversation

@gadmm
Copy link
Copy Markdown
Contributor

@gadmm gadmm commented Feb 23, 2022

This PR enables mixing declarations and statements. The motivation is the bump in supported compiler versions coming with 5.0.

The question is whether support for too old version of MSVC goes away. Here, too old means older than VS2013 (MSVC v18.0), which supports mixing declarations and statements.

Copy link
Copy Markdown
Contributor

@xavierleroy xavierleroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dra27 is the one who is most emotional about supporting old MSVC versions, so I'll wait for his opinion before pressing the Merge button. My opinion is that MSVC support for OCaml 5.1 is still unclear [edit: it will not be in 5.0, that's for sure], but if we can pull it at all, requiring a recent enough version of MSVC is completely acceptable. So, I'm in favor of this PR.

@gasche
Copy link
Copy Markdown
Member

gasche commented Feb 23, 2022

(I'm also in support, and I guess anyone else writing C code, this limitation is really annoying. I drool at the idea of for (int i = 0; ...)... and in fact it looks like they are already used in eventlog.c and lf_skiplist.c ?)

@dra27
Copy link
Copy Markdown
Member

dra27 commented Feb 23, 2022

Emotional is a funny way of putting it, but no objection from me - MSVC support requires at least C++'s <atomic>, which already makes it VS 2012+.

Microsoft's already put the C++23 version of stdatomic.h into VS 2022 and there's strong hints in it that the C11 version of it may be added in update, at which point I expect we'd make VS2022 the minimum.

@xavierleroy
Copy link
Copy Markdown
Contributor

OK, great! So let's merge and enjoy declarations as statements.

I'm not sure yet this needs a Changes entry; one can be added later if absolutely needed.

@xavierleroy xavierleroy merged commit 3440b25 into ocaml:trunk Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants