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

Handle implicit casts in translate-c #2296

Merged
merged 10 commits into from
Apr 24, 2019

Conversation

LemonBoy
Copy link
Contributor

Please review carefully and check out the XXX

@andrewrk
Copy link
Member

A very timely pull request. I'll review and probably merge this, and you should have a look at #1964 and #2295, because src/translate_c.cpp is about to get deprecated and src-self-hosted/translate_c.zig is about to become the new place to direct your efforts.

@LemonBoy LemonBoy force-pushed the translate-c-stuff branch 2 times, most recently from 846cea1 to 6336110 Compare April 20, 2019 09:46
// - Fold the comparison iif the value is either 0/1
// - Don't fold the comparison (this generates awkward code such
// as 1 != 0 for true or 0 != 0 for false
#if 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the "always try to constant-fold the comparison". I don't really see any downsides to it, do you?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the "always try to constant-fold the comparison"

Done!

I don't really see any downsides to it, do you?

Folding everything "erases" the constant value coming from the C code, but that's not much of a problem, I guess.

@andrewrk andrewrk merged commit ad994c9 into ziglang:master Apr 24, 2019
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

Successfully merging this pull request may close these issues.

2 participants