lcm-proj / lcm

Lightweight Communications and Marshalling
GNU Lesser General Public License v2.1
1.01k stars 393 forks source link

Clarify the array spec #508

Open judfs opened 7 months ago

judfs commented 7 months ago

I find this page surprisingly confusing: http://lcm-proj.github.io/lcm/content/lcm-type-ref.html#arrays

LCM supports multi-dimensional arrays consisting of primitives, structs, or constant declarations.

I am not sure what "constant declarations" could mean. As far as I can tell, nothing like const int32_t foo[2] = {1, 2}; is supported.

...: you cannot encode an LCM type that consists of a variable-dimension array.

This clarification existing is confusing? Like why is it even there? What would that even look like? X-D arrays aren't a type system level thing anywhere? Like I guess the idea is to say int32_t ndim; int32_t dimsizes[ndim]; float ndarrry<dimsizes> is not a thing that is supported. But, why would it? Could be a footnote at the end of the section, but not in the 2nd sentence.

point2d_list_t example: Might be worth spelling out "

struct point2d_list_t_alt
{
    const int32_t values_per_point = 2;
    int32_t npoints;
    double  points[npoints][values_per_point];
}

is essentially the same as point2d_list_t"?

.

Say upfront "LCM uses the C-style ; syntax."?