Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Array index vs. "user documentation" terminology? [closed]

I have an "array" of bytes that is referenced in some high-level client/developer documentation (which does not contain any programming language or environment specific information). In this document, bytes are currently referred to as "byte 3" or "byte 17", etc. The development environment is C/C++ and the bytes are stored in an array in which the starting index is 0 (naturally).

The problem is that developers may (have) interpreted "byte 3" in the document as meaning either myarray[3] or myarray[2].

What kind of terminology do folks use to make the "byte number" vs. "array index" distinction clear, yet keep it readable to both (non-programmer) clients and developers?

like image 642
craigh Avatar asked Sep 15 '26 16:09

craigh


2 Answers

One possibility is to just directly state where you're starting counting. Another possibility is to use things like "first byte", "seventeenth byte", and so on. A third (the one I usually prefer) is to speak in terms of offsets from the base address.

like image 188
Jerry Coffin Avatar answered Sep 17 '26 04:09

Jerry Coffin


What kind of terminology do folks use to make the "byte number" vs. "array index" distinction clear, yet keep it readable to both (non-programmer) clients and developers?

Array indices start at 0. (Or, 1. Take a stance and state it in your design document.)

like image 33
dirkgently Avatar answered Sep 17 '26 05:09

dirkgently



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!