Skip to content

New definition of datatypes in config

Which one is better?

The one we came up with on Slack:

#scalar1
my_scalar1: char

#scalar2
my_scalar2:
  type: char

#array
my_array:
  type: array
  element_type: int
  size: 6

#record1
my_record1:
  type: record
  sizeof: $recordSize
  members:
    m1:
      disp: 0
      type: char
    m2:
      disp: $mid
      type: array
      element_type: int
      size: [2, 2]
      subsize: [1,2]
      start: [1, 0]
    m3: 
      disp: $mc2
      type: char

#record2
my_record2:
  type: C_record
  members:
    - m1: char
    - m2:
        type: array
        element_type: int
        size: 5

or

#scalar1
my_scalar1: char

#scalar2
my_scalar2:
  type: scalar
  datatype: char

#array
my_array:
  type: array
  datatype: int
  size: 6

#record1
my_record1:
  type: record
  sizeof: $recordSize
  members:
    m1:
      disp: 0
      type: scalar
      datatype: char
    m2:
      disp: $mid
      type: array
      datatype: int
      size: [2, 2]
      subsize: [1,2]
      start: [1, 0]
    m3:
      disp: $mc2
      type: scalar
      datatype: char

#record2
my_record:
  type: C_record
  members:
    - m1: char
    - m2: 
        type: array
        datatype: int
        size: 5

The main difference is that in the second option the type always means the same.

What do you think?

Edited by Karol Sierocinski
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information