[dns-operations] Robert Graham - A Quick Review of the BIND9 Code.
Mark Andrews
marka at isc.org
Thu Jul 30 22:59:48 UTC 2015
In message <20150730222833.GB4460 at mycre.ws>, Robert Edmonds writes:
> The gcc optimization is opportunistic. It can only affect the object
> code that is generated by the compiler. Incidentally, constant
> propagation doesn't really have much to do with the 'const' qualifier:
>
> https://en.wikipedia.org/wiki/Constant_folding#Constant_propagation
>
> The 'const' qualifier has to be consciously added to a function
> prototype by the programmer when he or she designs the API. Paul is
> asking if there are any tools which can flag candidate functions where
> it makes sense to retroactively add the 'const' qualifier. Compiler
> passes that silently optimize the object code are not that tool.
>
> The big advantage of using the 'const' qualifier is that C compilers can
> flag violations of const-correctness at *compile* time, with
> diagnostics; that makes it easy for those bugs to be detected and fixed
> during the development process. The assertions in the BIND code are
> executed at *run* time; bugs that are only detected by those assertions
> can only be detected by running the compiled executable.
Theoretically many can be detected by static analysis.
Getting tools like Coverity to complain when a assert would fail
would be useful.
--
Mark Andrews, ISC
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742 INTERNET: marka at isc.org
More information about the dns-operations
mailing list