Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add -std=c++98 to compiler #9029
add -std=c++98 to compiler #9029
Changes from all commits
aaadbc5
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type system issues
type mangling rules?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a little more than just mangling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think a version identifier should be set. I think it's more suitable to use
__traits(getTargetInfo)
for this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good point. versions are boolean; a version token is either on or off, whereas this is a case where the C++ compatibility mode is a value from an enum...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't see preferring:
over:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is probably 90% use case:
This thing is definitely an enum, not a set of bool's.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@WalterBright If you want to use a
version
, then what do you do when you'll want to addCpp11
orCpp17
?Do you make
Cpp17
not implyCpp98
? Then, D code needs to be updated to check for both.Do you make
Cpp17
also automatically enableCpp98
? Then, what do you do in D code to detectCpp98
specifically?version(Cpp98) { version(Cpp17) {} else { /*do C++98 thing*/ }}
is a mouthful, but also, it breaks if you decide to introduceCpp11
or another interim version later.Manu is right - an enum solves both of these problems. Version numbers are points on a range, not a set of flags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't make sense... There's 2 moments with respect to everything that might have version distinction; before X, and after X. Versions dont express this.
What is your motive to resist on this? I don't understand the criticism.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't tackle the problem, though. Do you duplicate the code in
Cpp17
? And what do you do whenCpp11
is introduced?I'd be willing to guess 1) the implementation is much simpler 2) the implementation is already written.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same thing we do with operating system
version
s. There's a very good reason why versions are binary, not a level. Levels result in bugs, because they are open-ended rather than closed. With that and the code duplication argument, I've gone over that in the forum innumerable times, though I can't seem to get the druntime code to follow the idea correctly. People can't let go of the brittle C way of doing it.Lastly, the
Cpp98
is purposely looking backwards, not forwards. C++98 is not going to be changing, by definition.Cpp98
means "be compatible with the old version which will not ever change", not "be compatible with the latest version whatever that may be". This is why the use is:not:
It's a different way of framing the problem, and in my not-so-humble opinion, a better way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which ones are you referring to -
linux
/Windows
/ etc.?WINVER
is a number. (Theres_WIN32_WINNT_VISTA
etc. but I don't think anyone uses those; also, those go in the other direction, i.e._WIN32_WINNT_WIN7
implies_WIN32_WINNT_VISTA
is on)._MSC_VER
is a number.__GNUC__
is a number.__cplusplus
is a number.???
I guess you're saying
Cpp98
doesn't need to be a number because of what it does? Then, maybe, it is a bad / confusing name. Perhaps call itPreCpp11Mangling
or something...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a waste having to add a new version identifier for each version of C++. It's also receivers yet another version identifier that cannot be used by the user. BTW, therefore this is a breaking change. I might already be using the
Cpp98
version identifier and now my code will stop compiling since suddenlyCpp98
is reserved. Using a trait prevents that.