Good morning Uwe,
On Thursday, 31 May 2018 15:24:42 CEST Uwe Bonnes wrote:
> From 8b3de1f2b75119eb6d13761018085112b4bc2457 Mon Sep 17 00:00:00 2001
> From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
> Date: Thu, 31 May 2018 15:22:05 +0200
> Subject: examples/async.c : Short example using async reda/write.
applied, thanks! It's very good to have more example code.
May I ask for a small follow up patch as this is an
example code others could learn from?
- Replace magic numbers "15" and "3" in the code with constants.
- Have a short description what the code does at the beginning
of the file. Ideally describe that it's using MPSEE mode or
actually why it's using that.
In fact it currently states:
"LIBFTDI EEPROM access example"
:D
- Regarding the "while (index < 3)" loop: Here's a part that
I'm a bit unsure about: Should we add a safety exit condition
to the loop?
[Just a few days ago I debugged a full spool partiton on a customer
machine because the fax subsystem was stuck in an endless loop
outputting five log messages per second. The code in question included a newly
added rate limiting code and other safety measures, but somehow the
exit condition of the loop still wasn't triggered]
NASA "code rule" number two comes to mind:
https://en.wikipedia.org/wiki/The_Power_of_10:_Rules_for_Developing_Safety-Critical_Code
"2. All loops must have fixed bounds. This prevents runaway code."
Cheers,
Thomas
--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|