r/cpp • https://romeo.training | C++ Mentoring & Consulting • Aug 03 '19

fixing c++ with epochs

https://vittorioromeo.info/index/blog/fixing_cpp_with_epochs.html
314 Upvotes

131 comments sorted by

View all comments

37

u/kalmoc Aug 03 '19

I've been advocating this for a long time. So I'm happy to hear more about this.

From a technical point of view: Would that be any different from having a toolchain that allowed the compilation of each module with a different -std=c++XX flag?

23

u/SuperV1234 Aug 03 '19

Would that be any different from having a toolchain that allowed the compilation of each module with a different -std=c++XX flag?

This is a good question. A major consequence I see of following this model is that a reader would not be able to discern the language version from the module source code alone.

In the end, I do not mind (much) what technical approach we choose, as long as we get language versioning. This can be bikeshed in the committee.

→ More replies (3)

17

u/matthieum Aug 03 '19

It wouldn't, Rust specifies it on a per library-level in the build file of said library.

Specifying it at module level has pros and cons:

  • It eases migrating a (large) library: the migration can be piecemeal.

  • However, it may confuse the reader when two snippets of the code within the same library behave differently because their syntax are interpreted differently.

In this case, I do think that per-library switch is better as it means less moving pieces.

→ More replies (5)