Skip to content

Conversation

@avorobey
Copy link

Now variables can be declared within functions anywhere, not just
at the beginning, and enums can go into functions too.

The three similar declaration-parsing blocks are unified into one. The
end result is thereby negative code growth (-17 lines).

Now variables can be declared within functions anywhere, not just
at the beginning, and enums can go into functions too.
This could also easily work to support default parameter values,
simply by allowing ctx==Par and not only ctx==Loc in the condition.
Not sure how I feel about that, considering it's C and not C++...
else if (tk == Char) { next(); ty = CHAR; }
while (tk == Mul) { next(); ty = ty + PTR; }
if (tk != Id) { printf("%d: bad parameter declaration\n", line); return -1; }
if (id[Class] == Loc) { printf("%d: duplicate parameter definition\n", line); return -1; }
Copy link

Choose a reason for hiding this comment

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

What is the impact after the removal of Line 412?

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