[SystemSafety] A small taste of what we're up against

Olwen Morgan olwen at phaedsys.com
Thu Oct 25 18:15:29 CEST 2018


On 25/10/2018 16:51, Peter Bishop wrote:
> It certainly helps to avoid (or detect) certain coding bugs, but a
> program with defined semantics could still be written in a totally
> opaque way (e.g. meaningless variables, poor layout,no comments, etc)
> that would totally defy manual inspection.

For C code, QAC does a pretty good job of diagnosing inconsistent 
indenting and lack of comments. The way you use it is to base quality 
checks on the values of certain metrics like:

- comment density (=characters of comment / total non-space characters 
of code)

- no. of all-comment lines of code

- no. of blank lines of code

It's by no means foolproof but it does help.

As regards code layout, if QAC flags up inconsistent brace styles, you 
can simply run code through a pretty-printer set to your favourite brace 
style and then check that the output matches the input apart from 
redistribution of non-significant white space. Various other code layout 
rules can be enforced with a little scripting in sed, awk or something 
equivalent.

<snip>

> Another area that (most) languages do not address is concurrency, so
> Pascal might be better than C semantically *as a sequential program* but
> both are equally vulnerable to data races in a concurrent real-time
> environment, i.e. the behaviour is semantically ambiguous unless other
> concurrency control measures (outside the language semantics) are put in
> place.

Absolutely! That's why I like Erlang. I wish it were being made the 
subject of an international standard but I'm not aware of any efforts in 
that direction.

Olwen




More information about the systemsafety mailing list