# Proposed change to variable-length arrays

**URL:** <https://forum.opencyphal.org/t/proposed-change-to-variable-length-arrays/740>\
**Category:** Specification\
**Created:** [January 31, 2020, 4:53pm UTC](https://forum.opencyphal.org/t/proposed-change-to-variable-length-arrays/740 "2020-01-31T16:53:49Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [January 31, 2020, 5:39pm UTC](https://forum.opencyphal.org/t/proposed-change-to-variable-length-arrays/740/2 "2020-01-31T17:39:06Z")

</div>

I think the change proposed here would introduce a _special case_ by making the array length field implicitly aligned unlike other types:

 ![image](https://forum.opencyphal.org/uploads/default/original/1X/0b6fab231807999a648b1df3e775a76d601e47d6.png)

We [briefly discussed the possibility of introducing an opposite directive `@aligned` later in **v1.x** (x\>0)](https://forum.opencyphal.org/t/new-dsdl-directive-for-simple-compile-time-checks/190/2), but there are certain issues that arise with variable-offset fields. Specifically, let’s suppose that your proposal is implemented. How would you suggest it handle the following:

```python
uint3[<=16] a
@assert (_offset_ % 8).count > 1 # Yup, non byte-aligned.
# <-- Insert dynamic, runtime-computed padding here?
uint8[<=16] b

```

I think that explicit alignment with `@align` is more _ **aligned** _🥁 with the core design goals, but this is probably debatable. At any rate, this discussion should not be focused on arrays, because they are not special. There was a misguided statement made in [Big-endian vs. little-endian in the context of bit-level encoding - #4 by scottdixon](https://forum.opencyphal.org/t/big-endian-vs-little-endian-in-the-context-of-bit-level-encoding/428/4) where it was implied that the serialization rules of variable-length arrays differ from other data types – that is not true.

---

_[View the full topic](https://forum.opencyphal.org/t/proposed-change-to-variable-length-arrays/740)._
