Repository navigation
Small RTT cleanups - #3434
Small RTT cleanups#3434
Conversation
| NoDepth = -1 | ||
| }; | ||
| // An Rtt can have no depth specified | ||
| static constexpr uint32_t NoDepth = -1; |
There was a problem hiding this comment.
I'm fine either way, but what is the benefit of this approach? The type?
There was a problem hiding this comment.
Yeah, the type explicitly matches its uses, the code is slightly shorter, and it's consistent with other magic values defined in this file (i.e. _last_basic_type).
|
|
||
| const struct Rtt& getRtt() const; | ||
| // Gets the Rtt for this type, assuming that it is an Rtt type. | ||
| Rtt getRtt() const; |
There was a problem hiding this comment.
What's the benefit to removing const&? At least the const part seems nice to clarify that this does not return an item to be modified.
There was a problem hiding this comment.
There's no concrete benefit, but since #3428 we have a documented convention of passing Rtts by value. Once you're returning by value, I don't think the const has any effect.
There was a problem hiding this comment.
Isn't there a small benefit to disallowing getRtt().depth = 5 at compile time?
There was a problem hiding this comment.
I just checked locally and that is disallowed with or without the const with "error: expression is not assignable."
No description provided.