Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I think it should be kept in mind that the purpose of this code is that is should be correct according to specification in a safety critical system. As such correctness is more important than the code being easy to maintain etc. Using static code makes more compiler checks possible and correct proofs easier, but in this case the code probably got uglier (but I don't know any Ada so it is hard to say for me)

    For better explanations see the comments to the original article.

    • Many of the comments were interesting and I assume that my ignorance of Ada and the requirements are the reason why I am not understanding why this code is good. I would be surprised to hear that the NSA is touting bad code as good code, but then, I really don't know enough about them (who does?) to say. If the US Military had put this out instead of the NSA, I'd be far more likely to believe that it's bad.

      As for the Perl 6 code, I do think that the function is amenable to static compile-time analysis, bu

  • To start with, Ada indexes arrays starting with 1. Yes, I know that is ugly and weird (*cough* FORTRAN *cough*), but that is most certainly not an off-by-one error.

    Next, neither your p6 code or the java code addresses the line:

    subtype LogFileIndexT is LogFileCountT range 1 .. MaxNumberLogFiles;

    Granted there are some missing values here, specifically LogFileCountT and MaxNumberLogFiles. But these two help to define a range of acceptable indices for the LogFileNamesT array type.

    Now to the really bad as

    • And what people miss is that while this sort of safety is a must when lives are on the line, it is prohibitively costly to achieve in, say, one-liners.

      But programmers like to view the world in black&white.

    • Stevan, thanks for all of the background information here. It's nice to get a different perspective on things.

    • 16 is the magic number, even in ADA there is 2-complement HW.
      index 1-17, count=16

      I also deal with security relevant hard real-time code. We mostly use graphical environments there, Matlab Simulink, the deal with the additional complexity.

      There the checks are mostly runtime, not compile time! "Compile time" checks are done by the graphical environment, where boxes simply cannot be connected, or invalid parameters cannot be entered.