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

Keep literals for enum values #158

Closed
jacob-carlborg opened this issue Jul 3, 2017 · 1 comment
Closed

Keep literals for enum values #158

jacob-carlborg opened this issue Jul 3, 2017 · 1 comment

Comments

@jacob-carlborg
Copy link
Owner

jacob-carlborg commented Jul 3, 2017

Currently DStep translates the following code:

enum Foo
{
    a = 0x1,
    b = 0x2,
    c = 1 << 0,
    d = ((1 << 22) - 1)
};

To:

extern (C):

enum Foo
{
    a = 1,
    b = 2,
    c = 1,
    d = 4194303
}

It would be nice if the hexadecimal values from the original C code could be kept, like:

extern (C):

enum Foo
{
    a = 0x1,
    b = 0x2,
    c = 1 << 0,
    d = ((1 << 22) - 1)
}
@jacob-carlborg jacob-carlborg changed the title Keep hexadecimal literal for enum values Keep hexadecimal literals for enum values Jul 3, 2017
@jacob-carlborg jacob-carlborg changed the title Keep hexadecimal literals for enum values Keep literals for enum values Jul 3, 2017
ciechowoj added a commit to ciechowoj/dstep that referenced this issue Oct 19, 2017
ciechowoj added a commit to ciechowoj/dstep that referenced this issue Oct 21, 2017
ciechowoj added a commit to ciechowoj/dstep that referenced this issue Oct 21, 2017
ciechowoj added a commit to ciechowoj/dstep that referenced this issue Oct 21, 2017
ciechowoj added a commit to ciechowoj/dstep that referenced this issue Oct 21, 2017
ciechowoj added a commit to ciechowoj/dstep that referenced this issue Mar 18, 2018
ciechowoj added a commit to ciechowoj/dstep that referenced this issue Mar 18, 2018
jacob-carlborg added a commit that referenced this issue Mar 18, 2018
…nslation

Implement #157, #158: Improve enum value translation.
@jacob-carlborg
Copy link
Owner Author

Fixed in 50919b6.

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

No branches or pull requests

1 participant