[riot-notifications] [RIOT-OS/RIOT] periph/timer: Fix return codes of timer API (#12199)

Kaspar Schleiser notifications at github.com
Wed Sep 11 14:32:04 CEST 2019

I'm not sure I agree on this.

1. for functions returning true/falls (e.h., timer_has_expired()), it should be clear that 1 is success and 0 is non-successs, so we can write ```if (timer_has_expired())...```

2. for all the others, IMO returning "0" for success and "<0" on error feels most fitting. If no specific (POSIXy -EFOOBAR) can be found, default choice would be "-1". Posix usually sets "-1" on error + more specific error in "errno".

Quick grepping shows >350 cases on "-1 on error" or "<0 on error".
The only two case where I could find "1 on error" is in the openthread package.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190911/bc7978ab/attachment.htm>

More information about the notifications mailing list