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
this is a set of modifications to modernize parts of the code #1515
base: master
Are you sure you want to change the base?
this is a set of modifications to modernize parts of the code #1515
Changes from 12 commits
258c692
3e4201e
e7858e3
0d1ce28
e53e7ec
83e11f2
4ea1271
d5b0ce6
9840aea
19d1149
79bd917
628841a
d9d3b8e
da62cf3
9ef170e
080ae43
1684bb1
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.
I don't know if the identity matrix should be constexpr. Something being both static and constexpr may already be a bit of a paradox. But the identity matrix is loaded as a buffer from a pointer, which means it can't actually be constexpr easily by a compiler. And it might be more optimal just to have one copy of the buffer in memory anyway.
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.
static constexpr
is perfectly valid. Sometimes you have things that can be used at both compile-time and runtime. In this case, we aren't doing any compile-time matrix math, so it probably makes more sense to just leave this one alone. I doubt that the generated machine code is any different since we're just going to be pushing a pointer onto the stack.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 revert this if desired
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.
This should probably remain an
hsVector3
for type safety and clarity. I don't think there's any performance impact here.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.
fair enough i just found it as duplicating the type since the function already returns it.
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.
Always better to use the defined constructor for an object instead of pushing in memory directly. Even if it's a bit duplicative with the type name.
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.
@dgelessus - I see your emoji. I'm poking at this and I see C++ is policing the number of elements in the struct. However - this struct does have a defined constructor and it does seem weird to go around it.
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.
Ah, I wanted to explain later and forgot, sorry. As I understand it, the brace syntax in this case will use the constructor defined in the class, despite the brace syntax. According to cppreference, the C-style field by field initialization is called aggregate initialization, which never applies to classes with user-defined constructors. Instead, the brace syntax does list initialization here, which in this case calls the normal constructor, exactly like the previous code.
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.
@dgelessus Thanks! I'll review the docs.
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.
We prefer to use standards compliant mechanisms. AFAIK,
isatty
is part of the POSIX standard. The Windows SDK just emits an erroneous deprecation warning withisatty
and wants_isatty
(which is just the Microsoft way of making life more difficult for cross-platform development). Is there a particular bug that is fixed by using(GetFileType(fileinfo) == FILE_TYPE_CHAR)
instead of_isatty
?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.
yes it does if the user attempts compile and run the game using msys2 or cygwin the value of _isatty can be invalid.
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.
In that case, you should probably fix the preprocessor checks to detect that situation to use
isatty
.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.
shouldnt HS_BUILD_FOR_WIN32 handle that?
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.
HS_BUILD_FOR_WIN32
will be defined for MSVC, clang-cl, and mingwIn this case, you'll need an extra check for mingw to avoid aliasing isatty
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.
This still seems to be using non-standards complaint naming, unfortunately. We prefer the POSIX standard
isatty
.