8000 Don't assume long == 64-bit · Issue #79 · ssm-lang/Scoria · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Don't assume long == 64-bit #79

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

Open
j-hui opened this issue Aug 12, 2021 · 0 comments
Open

Don't assume long == 64-bit #79

j-hui opened this issue Aug 12, 2021 · 0 comments
Labels
good first issue Good for newcomers not-urgent Use this labels for issues that are not urgent.

Comments

@j-hui
Copy link
Collaborator
j-hui commented Aug 12, 2021

We currently assume that C defines typedef int64_t long and typedef uint64_t unsigned long. This is not true on all platforms; for instance, Apple M1 and my NRF52 board (maybe this is an Arm-specific thing?).

Most of the generated code should be fairly robust to this, since we use our own i64 and u64 definitions. But two places where we rely on long == u64 are:

  • The formatter, which uses %ld and %lu.
  • Literals, which use 42L.

At the very least, this throws warnings. At worst, this causes unexpected behavior. We should modify the Backend compilation pass to be parametrized by some idea of what size the platform thinks long is, or better yet, make Backend agnostic of this issue and push the matter into C.

@j-hui j-hui added good first issue Good for newcomers not-urgent Use this labels for issues that are not urgent. labels Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers not-urgent Use this labels for issues that are not urgent.
Projects
None yet
Development

No branches or pull requests

1 participant
0