Sounds quite reasonable to this novice c coder :)

On Fri, Jun 1, 2018, 2:23 AM Willard Goosey <[email protected]> wrote:

> OK, though I've been pretty distracted I'm still moving towards a beta
> release for the SmallC lib. I want to be able to freeze the interface
> so that there will be backwards compatibility from any further versions.
>
> ESR recently made a blog post about "Defect Attractors" -- design
> features that are easily misused or otherwise sort-of encourage bugs.
> As you can imagine, shims from one language to another (say, an assembly
> ROM API to a C lib...:) are big offenders here, if only because the
> mindset of the "hidden" language still tends to be visible in the
> interface and that's jarring.
>
> I've been thinking about this, and one function in particular keeps
> jumping to my mind. prsnam().
>
> The current prototype is prsnam(char *s, int i)
> parses a file.do filename into the FILNAM system variable as FILE  DO
> s=filename
> i=length of filename.
>
> And I see a Defect Attractor here! If a proper C function wants to know
> the length of a string it calls freaking strlen() on it. It does not
> expect the caller to do its job for it.
>
> So I propose to replace it with prsnam(char *s) that will call
> strlen() itself, making the interface a little simpler and removing a
> Defect Attractor.
>
> Any thoughts?
>
> Willard
> --
> Willard Goosey  [email protected]
> Socorro, New Mexico, USA
> I search my heart and find Cimmeria, land of Darkness and the Night.
>   -- R.E. Howard
>

Reply via email to