Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C2118 - negative subscript #54

Closed
klanger59 opened this issue Nov 28, 2021 · 2 comments
Closed

C2118 - negative subscript #54

klanger59 opened this issue Nov 28, 2021 · 2 comments

Comments

@klanger59
Copy link

klanger59 commented Nov 28, 2021

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
Copy link
Contributor

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
Copy link
Author

klanger59 commented Nov 30, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants