Okey, I had a look and here are my comments!
Have a look and lets discuss
Overall it looks really good only a few minor things I found.
1. A lot of "static inline", should generally be avoided. Why is this used here and not only inline? (static inline is more of a C-thing)
2. Mempool does not use templates, but void pointers. It is extended by ObjectPool, which is the desired usage, does MemPool want to be viewed as it is using unformated memory?
3. Why was BaseStaticThread removed? It was a concise way to create a thread with minimal chance for errors by using the template argument to create working areas etc.
4. A lot of prototypes omit "const" qualifier (sizes, time periods, etc), should probably be made const to convey the message of constants and to help the compiler.
5. A lot of the standard macro definitions could be converted for C++ usage with "constexpr" to guarantee that the compiler calculates the final value at compile time.
Should this be included perhaps?
6. The code breaks the 80 column width limit here and there.
7. The demo should add -std=c++11 since the wrapper is designed for C++11.
8. In the syscalls_cpp.cpp, when the usage of the heap is disabled the usage of new and delete should produce errors, maybe add something like this (recommended to have it call an unimplemented function to cause a link-time error):
Code: Select all
/**
* @brief Define non-existing function to catch the usage of new.
*/
extern void you_tried_to_use_new(void);
/**
* @brief Define non-existing function to catch the usage of delete.
*/
extern void you_tried_to_use_delete(void);
/**
* @brief Redefinition of new to stop the usage of it.
*/
void* operator new(size_t size) {
(void)size;
you_tried_to_use_new();
return NULL;
}
void* operator new (size_t size, void* ptr) {
(void)size;
(void)ptr;
you_tried_to_use_new();
return NULL;
}
void* operator new[](size_t size) {
(void)size;
you_tried_to_use_new();
return NULL;
}
void* operator new[](size_t size, void* ptr) {
(void)size;
(void)ptr;
you_tried_to_use_new();
return NULL;
}
/**
* @brief Redefinition of delete to stop the usage of it.
*/
void operator delete(void* ptr) {
(void)ptr;
you_tried_to_use_delete();
}
void operator delete[](void* ptr) {
(void)ptr;
you_tried_to_use_delete();
}