Cycling74 / max-sdk

Software Development Kit for Max by Cycling '74
Other
262 stars 57 forks source link

C2118 - negative subscript #54

Closed klanger59 closed 2 years ago

klanger59 commented 2 years ago

CLASS_ATTR_FLOAT(c, "middle_c", ATTR_FLAGS_NONE, t_scl2list, t_sclMiddleC); and CLASS_ATTR_FLOAT_ARRAY(c, "scl2list", ATTR_FLAGS_NONE, t_scl2list, t_sclMappingValues,1024); generates compiler error C2118 on VS 2022. it was working with sdk 8.0.3

Best regards Klaus

isabelgk commented 2 years ago

Hi Klaus,

It would be good to narrow it down to whether this is an SDK 8.0.3 --> 8.2.0 issue or a VS 2019 --> VS 2022 one. Have you tried different combinations?

It's hard to tell much more without more context as well. A negative subscript sounds like the static assertions we use to check that the correct type is passed is failing. For example, CLASS_ATTR_FLOAT:

C74_STATIC_ASSERT(structmembersize(structname,structmember)==sizeof(float))

If the type t_sclMiddleC is not a float, then the assertion will occur.

klanger59 commented 2 years ago

Hi Isabel,

thank you for the hint. t_sclMiddleC is a double. i started with VS19 & SDK 8.0.3 and VS22 & SDK 8.0.3 the issue came up with VS22 & SDK 8.2.0.

Changing to CLASS_ATTR_DOUBLE solved my issue.

Thanks a lot; i am happy; and have a nice day Klaus