See the point to avoid... and also the point that a wrapping layer can take care of the read/write 1, 2, or n.
Regarding a robust/safe API: with the paradigm all power to the app, just taking the passed in data and write works. I'd like to prefer though having the support of an (optional) safe guard, which makes above paradigm and the bare metal version even more applicable... ...without any memory manager. Even though there is just a pointer passed, the pointer does not point to bare date (data bytes). The pointer points to an object which includes meta data... such as the length of the array/string... that's the reason that I actually never much liked C in an (business) application context, where tracking byte counts should not really be part of the problem to be solved.
Saving space is a noble thing. Making the app waste it before every write to be safe not so much. Please no offense taken here.
Are you considering of implementing the module natively? ...then saving space has a totally different ranking... ;)
© Espruino, powered by microcosm.
Report a problem