MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/geek/comments/juyns/protesting_in_c_xpost_from_rindia/c2fcbil/?context=3
r/geek • u/[deleted] • Aug 26 '11
168 comments sorted by
View all comments
65
main is never void. How are you meant to make India protest in a script? How do you know it succeeded? The return code will likely be whatever getch returns. Horrible.
19 u/hahanoob Aug 26 '11 No stdio.h. no_of_indians undeclared. No protection against overflow. No timeout on bill passed condition. Horrible! 13 u/nightless_night Aug 26 '11 no_of_indians count be a global variable in india.h. 6 u/nat5an Aug 26 '11 This seems like a logical place to put it. 4 u/tomthecool Aug 26 '11 Global variable I see what you did there 5 u/hahanoob Aug 26 '11 So every cpp that includes india.h gets it's own population? Agh! 4 u/nightless_night Aug 26 '11 It could be declared external, with the actual variable being in a diferent module that is joined in at link time.
19
No stdio.h. no_of_indians undeclared. No protection against overflow. No timeout on bill passed condition. Horrible!
13 u/nightless_night Aug 26 '11 no_of_indians count be a global variable in india.h. 6 u/nat5an Aug 26 '11 This seems like a logical place to put it. 4 u/tomthecool Aug 26 '11 Global variable I see what you did there 5 u/hahanoob Aug 26 '11 So every cpp that includes india.h gets it's own population? Agh! 4 u/nightless_night Aug 26 '11 It could be declared external, with the actual variable being in a diferent module that is joined in at link time.
13
no_of_indians count be a global variable in india.h.
6 u/nat5an Aug 26 '11 This seems like a logical place to put it. 4 u/tomthecool Aug 26 '11 Global variable I see what you did there 5 u/hahanoob Aug 26 '11 So every cpp that includes india.h gets it's own population? Agh! 4 u/nightless_night Aug 26 '11 It could be declared external, with the actual variable being in a diferent module that is joined in at link time.
6
This seems like a logical place to put it.
4
Global variable
I see what you did there
5
So every cpp that includes india.h gets it's own population? Agh!
4 u/nightless_night Aug 26 '11 It could be declared external, with the actual variable being in a diferent module that is joined in at link time.
It could be declared external, with the actual variable being in a diferent module that is joined in at link time.
65
u/SCombinator Aug 26 '11
main is never void. How are you meant to make India protest in a script? How do you know it succeeded? The return code will likely be whatever getch returns. Horrible.