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

Small-C: Support local variable initialization #7

Open
ZaneDubya opened this issue Dec 23, 2017 · 0 comments
Open

Small-C: Support local variable initialization #7

ZaneDubya opened this issue Dec 23, 2017 · 0 comments

Comments

@ZaneDubya
Copy link
Owner

ZaneDubya commented Dec 23, 2017

“Instead of always waiting for the first executable instruction in a block before allocating space for locals, when an initializer is found, allocate pending locals, then evaluate the initializing expression and push the result onto the stack as the current object. Whereas global initializers must be constant expressions, local initializers are not so restricted. Originally, C did not support initializing local arrays, current compilers tend to allow it, however. Is this something you want to support? Don't forget that the element values must be pushed from right to left so the first element will have the lowest address. Also, uninitialized elements should be set to zero. ” -Excerpt From: James E. Hendrix. “A Small C Compiler.”

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