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

[C++] Computed instances are int32_t #617

Open
KOLANICH opened this issue Sep 2, 2019 · 2 comments
Open

[C++] Computed instances are int32_t #617

KOLANICH opened this issue Sep 2, 2019 · 2 comments

Comments

@KOLANICH
Copy link

KOLANICH commented Sep 2, 2019

Computed instances in C++ code have types int32_t, which breaks the code needing them to be uint64_t and is inefficient for the code for which uint16_t is enough.

So we need

  1. set them to int64_t as a quick fix
  2. implement Types in instances and fields having content #127
  3. implement derivation of the sizes based on operations used and types of operands and/or usages of the result. More precisely, everything used as an array index must be unsigned and everything used in pos must be size_t.
@GreyCat
Copy link
Member

GreyCat commented Nov 21, 2019

This is basically the same problem as raised in #257 and #510.

set them to int64_t as a quick fix

Probably it's better than nothing.

implement #127

It won't help. Setting result type for expression is not enough in general case.

implement derivation of the sizes based on operations used and types of operands and/or usages of the result.

It is not really possible without introduction of some sophisticated static analysis logic that will know all implicit convergence rules for all the languages (and they might be considerably different).

More precisely, everything used as an array index must be unsigned and everything used in pos must be size_t.

There is no concept of "unsigned" in Java, for example, and it's impossible to map concept of size_t into any solid type — it depends only on C++ implementation. Not to mention that actually there's no size_t in C++ (it's C type), and C++ streams actually work with std::iostream::pos_type and std::iostream::off_type.

@KOLANICH
Copy link
Author

Not to mention that actually there's no size_t in C++ (it's C type), and C++ streams actually work with std::iostream::pos_type and std::iostream::off_type.

Thanks for the info.

It is not really possible without introduction of some sophisticated static analysis logic that will know all implicit convergence rules for all the languages (and they might be considerably different).

It has to be done.

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