c
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
c [2015/12/31 02:32] – [Use goto] admin | c [2015/12/31 02:35] – [Single return point] admin | ||
---|---|---|---|
Line 2: | Line 2: | ||
I've been writing c for over 30 years, but it can still be a nightmare - the problems are well documented elsewhere. The discipline of writing device drivers for Linux/ | I've been writing c for over 30 years, but it can still be a nightmare - the problems are well documented elsewhere. The discipline of writing device drivers for Linux/ | ||
====Single return point==== | ====Single return point==== | ||
- | Every routine should have a single return point. All possible execution paths go through this point and therefore have the chance to have resources released. The main thing, of course, is to free resources that are no longer needed eg memory that has been malloc()' | + | Every routine should have a single return point. All possible execution paths go through this point and therefore have the chance to have resources released. The main thing, of course, is to free resources that are no longer needed eg memory that has been malloc()' |
====Error responses should be close to the failing statement==== | ====Error responses should be close to the failing statement==== | ||
and not dangling at the end of some huge }}}} block ten pages away!!! Deal with it _now_, to hell with making the Happy Path clearer - the Happy Path is easy, it's the errors that make the thing beastly. | and not dangling at the end of some huge }}}} block ten pages away!!! Deal with it _now_, to hell with making the Happy Path clearer - the Happy Path is easy, it's the errors that make the thing beastly. |
c.txt · Last modified: 2020/10/17 03:05 by 114.119.151.1