Re: "Task Manager" for RTOS?
Posted: Thu Oct 17, 2013 12:06 pm
I would suggest the signature could be improved toThat is, promise the caller that you're not going to change the pointer itself (it also allows you to accept both const and non-const ptrs). Personally I think the safest, clearest (at least to me) signature would be Then it's obvious you're not taking in any value, you don't worry about const pointers and such and you don't have to check that you weren't passed a null pointer and don't have to worry about corrupting anything if you were passed a bad pointer. The downside is the caller has to rely on either documentation (or convention based on the name) that result.first contains the CurrentTaskTime and result.second contains the TotalTicks. Come on Dan, if you don't help drag people kicking and screaming to the STL who will?
Code: Select all
uint32_t GetCurrentTaskTime( uint32_t * const TotalTicks );
Code: Select all
std:pair<uint32_t, uint32_t> GetCurrentTaskTimeAndTotalTicks();