[riot-notifications] [RIOT-OS/RIOT] sys/ztimer: initial import (#11874)

Marian Buschsieweke notifications at github.com
Fri Sep 6 11:50:44 CEST 2019


> > Converting from a generic to a specific (e.g. `ztimer_dev_t *` to `ztimer_periph_t`) could be moved to a static inline function. That will make refactoring easier, e.g. if the structure layout of `ztimer_periph_t` changed that `ztimer_dev_t` no longer is the first member.
> 
> Would the already existing [`container_of`](https://github.com/RIOT-OS/RIOT/blob/master/core/include/kernel_defines.h#L30) macro be the solution here? It keeps working when the structure layout of `ztimer_periph_t` changes.

The good think with the static inline is, if e.g. `ztimer_dev_t *` and `ztimer_periph_t *` will at some point no longer be convertible, removing the inline function would break (at compile time) all code that still tries to convert - including some out of tree code of RIOT users. That would be much better than hard to trace runtime bugs. (But using `container_of()` in that static inline function sounds like a very good idea to me.)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11874#issuecomment-528790837
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190906/14c6a615/attachment.htm>


More information about the notifications mailing list