Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd control over the C/C++ standard #191
Comments
This comment has been minimized.
This comment has been minimized.
|
I think there's sort of a general question about whether I'd personally be wary of attempting to provide such a guarantee though. If signaling this as an intent in a cross-platform manner makes sense I think we should at least have an option to specify doing it, but it seems like a lot of possible pain for not a lot a lot of possible gain otherwise. |
This comment has been minimized.
This comment has been minimized.
|
Even if we don't set one by default we might want a way to select the standard in use so that users can have confidence what they are getting. I'm not sure how easy it is for users to get those flags right themselves today, maybe a dedicated method is worthwhile, like More generally, I don't know how easy it is to pick the correct compiler-specific flags with this crate today. I guess when people want to distinguish between compilers they probably ask the environment for the target family (or something), and if it's MSVC, do the MSVC thing, otherwise do the gcc thing? |
This comment has been minimized.
This comment has been minimized.
|
Yeah definitely makes sense to me to have these available, even if not set by default! Right now there's no way to query whether a compiler is msvc-like or gcc-like, it's just inference based on the target mostly. |
alexcrichton
closed this
Jul 17, 2017
alexcrichton
reopened this
Jul 17, 2017
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Thanks for the investigation! Seems like we can at least do 14 and maybe 17 as well? Perhaps we could panic for now if the standard isn't supported? That should at least give us flexibility into the future |
alexcrichton
closed this
Jul 20, 2017
alexcrichton
reopened this
Jul 20, 2017
This comment has been minimized.
This comment has been minimized.
I have codebase that uses C99 features throughout, so I absolutely require a guarantee that at-least-C99 standard is supported, or my code simply won't compile. |
This comment has been minimized.
This comment has been minimized.
Is it to force users needing C99 to explicitly turn it on? Current versions of clang, gcc and MSVC all default to C99 or later (or at least their best attempt at it). |
This comment has been minimized.
This comment has been minimized.
|
Please note that GCC takes If you set the default to If you want to deliberately limit C support to the lowest common denominator with older MSVC, then I suggest using |
brson commentedJul 13, 2017
I'm confused about our resolutions over this issue. We discussed quite a bit about controlling the C/C++ standard in use, and part of this issue was (I thought) to define C++ standard enums to pass to
link_stdlib. That method is not about the standard in use though, so I'm not clear on the design here.What I think we want is:
c_standardmethod that takes an enum and causes the builder to pass the appropriate flagscpp_standardmethod that takes an enum ' 'Needs more discussion. cc @alexcrichton @sfackler @Kimundi @dtolnay @BurntSushi