• It seems like in a C-like loop, for EG: ...you could have a loop construct that instead looks like:
  • The latter would check if 0 is large enough, and n-1 is small enough, and then execute the actual loop iterations without (further) bounds checking - because we know 1..n-2 have to be in-bounds if 0 and n-1 were (for sufficiently large n).
  • Granted, not all loops could be done this way: function calls and mmap would complicate matters, but I believe many loops could be safe and fast this way.
  • Also, of course, C arrays usually do not have a length associated with them. This example is more for C-like languages.



  • Hits: 88
    Timestamp: 2025-11-18 06:14:28 PST

    Back to Dan's tech tidbits

    You can e-mail the author with questions or comments: