Ok, so I got 2 points deducted AGAIN for the same fucking non-error.
It’s so fucking irritating.
Here’s what he said:
—
Good, but you still did not handle the compiler warnings (“not all control paths return a value”) in isBefore and isAfter (-2 for exercise 2) — 48/50 for lab 8. Non-void functions should ALWAYS return something from EVERY control path. You had this problem in lab 6 and lab 4. I discussed this with you at length already. You will have to decide whether you want to adhere to this programming practice or not.
—
Not all control paths return a value? What? Since fucking when?
int isAfter(const tod* t1, const tod* t2) // true if 1st is after 2nd
{
if(diffTod(t1, t2) > 0) {
return 1;
} else if(diffTod(t1, t2) <= 0) {
return 0;
}
}
Now to me that looks like I test for > 0 in the first if statement and <= 0 in the second one. Now, that covers everything below zero, everything above zero AND zero itself. How is that not everything?
Characters are integers, floats/doubles would be truncated automatically… What am I missing?
NOTHING! I’m not missing anything, it’s my teacher missing something and that something is either logic, understanding, or sense.
Stupid moron teacher. Continue reading →
Copy and paste this URL into your WordPress site to embed
Copy and paste this code into your site to embed