Follow-up Comment #9, bug #68812 (group groff):

[comment #8 comment #8:]
> That doesn't mean the type is wrong; it means the type can hold values that
> are not useful for array indexing.  But this is almost always the case for
> arrays anyway: if an array has 12 elements, _any_ data type for the index
> will contain values invalid for that array.  It remains the responsibility of
> the code accessing the array to use only valid array indices.  The data type
> of the index cannot help in this task, except in very limited circumstances
> (e.g., an array with exactly 256 elements).

This is because C has crappy data types that are an artifact of deep
resentment toward the notion of having data types at all.

Ritchie and Thompson were fond of glorious, typeless B.  :-|

Ideas like [http://archive.adaic.com/standards/83rat/html/ratl-04-04.html#4.4
Ada's range-checked subtypes] were
[https://www.cs.virginia.edu/~evans/cs655/readings/bwk-on-pascal.html
denigrated by no less than Kernighan himself (in the context of Pascal).]  Too
expensive to do them at runtime, they said.  And too hard for the compiler to
verify simple theorems about whether out-of-range access were possible, they
said.

Decades later, C partisans have derpily decided that it's okay if the compiler
proves theorems about out-of-range accesses after all.  They of course
[https://learn.adacore.com/courses/intro-to-spark/chapters/03_Proof_Of_Program_Integrity.html
don't disclose where such ideas came from].

But they still don't want to express valid index ranges in their type system.
If someone tries, in a declaration,
[https://news.ycombinator.com/item?id=18785892 they say it "looks weird"].  Of
course WG14 solved the problem as if they themselves resented having do so,
freighting the keyword `static` with **yet another** meaning.

Lightning.

Lightning.

Strike them all with lighting.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?68812>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to