Memory type indexing

Any idea why memory type indexing starts from 1? For instance, in Python api,

>>> sl.MEM(1)
<MEM.CPU: 1>
>>> sl.MEM(2)
<MEM.GPU: 2>
>>> sl.MEM(0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ymtoo/anaconda3/lib/python3.8/enum.py", line 339, in __call__
    return cls.__new__(cls, value)
  File "/home/ymtoo/anaconda3/lib/python3.8/enum.py", line 663, in __new__
    raise ve_exc
ValueError: 0 is not a valid MEM

Other enum types are fine.

>>> sl.ERROR_CODE(0)
SUCCESS
>>> sl.ERROR_CODE(1)
FAILURE
>>> sl.MAT_TYPE(0)
<MAT_TYPE.F32_C1: 0>
>>> sl.MAT_TYPE(1)
<MAT_TYPE.F32_C2: 1>

My setup:

  • Ubuntu 20.04
  • ZED SDK 3.6
  • pyzed 3.6

Reference:
https://www.stereolabs.com/docs/api/group__Core__group.html#ga3fc8f9f9f84fbb0f728fc2cd399ade29

This is explicitly set to 1 and 2 because other values are reserved for internal use.

Did you encounter an issue caused by this? Or was it by curiosity?

It’s just out of curiosity since the indexing of other enum types starts from 0. Thanks!