-
Notifications
You must be signed in to change notification settings - Fork 7.1k
[c++] Allow RayConfig to have items other then integer #4701
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
Conversation
|
Test PASSed. |
|
Test FAILed. |
jovany-wang
left a comment
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.
Nice change!
src/ray/ray_config.h
Outdated
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.
Another approach to reserve the ; for every RAY_CONFIG () statement is to add a RAY_IGNORE() at the end of this macro like:
#define RAY_CONFIG(type, name, default_value) \
if (pair.first == #name) { \
std::istringstream stream(pair.second); \
stream >> name##_; \
continue; \
} \
RAY_IGNORE(nothing)But I don't know if this way is good enough.
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 way looks a bit wired. We can wait for other developers' comments.
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 this is wired since it's similar to RAY_LOG().
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 have a slight preference for requiring a ; after the macro also. If you add RAY_IGNORE at the end, then I'd suggest including a comment to explain its purpose.
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.
OK, will do.
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.
Adding RAY_IGNORE looks fine to me as well.
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.
RAY_IGNORE_EXPR(0) can only be used in functions. It is not allowed to use RAY_IGNORE_EXPR(0) when a class is defined. I used another way to may the ; required.
87eefd6 to
7b15c8a
Compare
|
Test PASSed. |
7b15c8a to
e682717
Compare
|
Test PASSed. |
|
Test FAILed. |
src/ray/id.h
Outdated
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 way seems more weird. I slightly prefer to just remove the semicolons.
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. Since the Macro is only used in id_def.h and ray_config_def.h, it won't break the traditions in most c++ files.
e682717 to
fae1b14
Compare
|
Test PASSed. |
|
Test FAILed. |
raulchen
left a comment
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.
LGTM
This PR contains changes that help with memory issues ray-project#4701
What do these changes do?
id_def.handray_config_def.h, some compiler will raise some warning message showed below.Related issue number
N/A
Linter
scripts/format.shto lint the changes in this PR.Test
Since there is no other types used in ray config now, I test the case of using
double,bool,std::stringby myself. The code works fine.