Newsgroups: ut.cdf.csc270h
From: ajr (Alan J Rosenthal)
Subject: Re: warning messages
>When I run make I get warning message however my program works just fine...
>will I get marks off for warnings?

Yes.

Warning messages indicate that you are doing something improper. It may fail to work on other C compilers, for example (you'd have to specify the particular error message for me to say whether or not this is the case here). In this course we are writing careful, correct, tidy, and maintainable C programs.

Sometimes students who receive low marks for programs insist "but it works!!". First of all, this often turns out not to be the case, and it only works on a few test inputs (and there's a much easier program which does that! just do an 'if' statement and test for those particular inputs and then print the pre-calculated constant correct output value). But most of all, as a computer programmer adopting a project I would much rather receive a non-working but mostly careful and correct and tidy program, than a "working" but disorganized and untidy program.

The well-organized program can be fixed and then you have a working, careful, correct, tidy, maintainable program.

The disorganized program needs to be rewritten to become this. It may work at the moment, but when you make modifications to it, you will introduce bugs because of surprising interactions between different parts of the program, or because you misunderstand what's going on because it's so badly written. These programs get discarded unless they have absolutely huge backing behind them (or unhappy users who have no options). Well-organized programs live on.

For a current industrial example, take Microsoft's IIS web server. This has been the subject of so many security-related bugs recently that even Microsoft is saying that they're going to have to rewrite it from scratch. They've been fixing bugs here and there (on a huge budget!), but there are always more, it's out of control, and it's got to get thrown out.

Even though it "works". It's still no good and it's not fixable and they're giving up. In their case, they have the ability to absorb this and rewrite the program, doing a better job this time (hopefully!). In other cases, this sort of debacle causes companies to fold.

In this course we're trying to write programs right, in all of these ways. Warning messages are the compiler telling you something about your program. They are useful. They should not be disregarded. If you don't understand what they are telling you, ask your course instructor (and give him/her the specific error message and the code which is causing it).


[assignment one Q&A] [main course page]