3 ms·
The same principals apply, it just becomes more difficult to understand what your language may be doing for you in this regard. Compound types in most language
by Arelius 12y ago
The same principals apply, it just becomes more difficult to understand what your language may be doing for you in this regard.
Compound types in most languages will store their members contiguously, at least in cases where easy to do so. And arrays are generally contiguous in addition.
The problems often crop up in not being able to have compound value-types and are instead often included by reference.
Some languages, including C# IIRC, allow you to define specific types to be treated by value (structs in C#) which can often help. It may also be better to have a few arrays with primitive types in them, rather than a single array of compound types, for instance.