-
Notifications
You must be signed in to change notification settings - Fork 870
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
adds support for optional args, with backwards compatibility #64
Conversation
Per #50, not yet clear how best to handle the |
Added macro checks for GNU extensions. |
@kzidane, @crossroads1112 able to test on Visual C? |
|
Sorry for my being late, but as an alternative, what about temporarily (until optional arguments are no longer required) doing something like the following: In
In
In
Pros: Completely standard ISO C (no need to worry about VC vs GNUC or change the Makefile) |
@crossroads1112, I worry that introducing the If this proves an issue for, e.g., Windows, we can just offer a version |
This changes
get_*
to expect astring
as their sole parameter, which is then used to prompt (and, if need be, re-prompt) the user for the intended type of input. Our prior use of aRetry:
prompt was feeling arbitrary. Plus, this way, students can control not only the first prompt a user sees but any (identical) re-prompts.Maintains backwards compatibility with prior versions of the library such that students (for now) can still call
Get*
andget_*
with no arguments; in those cases, the library behaves as it used to withRetry:
re-prompts.After CS50 AP 1617 wraps in June 2017, we can remove support for
Get*
altogether (or just leave the deprecation warnings in there for a year). After CS50 AP 1718 wraps in June 2018, we can remove support for optional arguments toget_*
, instead requiring that a user provide a prompt (which could still be""
); probably no need at that point to allowNULL
as input, since that's only used now as a sentinel value to indicate that a caller is using the functions' older argument-less calling conventions.