-
Notifications
You must be signed in to change notification settings - Fork 855
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
Define internal vget_string helper function #176
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instead of messing around with the
get_string
macro, and having one definition inside cs50.c and another definition everywhere else, the cs50 code should demonstrate good knowledge of the C programming language and its larger ecosystem by implementingget_string
in the same way as the C Standard Library implementsfprintf
:fprintf
, which takes varargs and behaves as if it callsvfprintf
internally.vfprintf
, which takes ava_list
as argument.This makes the code much cleaner and gets rid of the confusing macro. Remember, your students will look at that code and will use it as a role model, and if they later learn that your code style is bad, they will mistrust you in everything else you taught them, and rightly so.
The text was updated successfully, but these errors were encountered: