Scott Moore wrote:
Pascal and C deserve to be treated completely differently with regards to warnings. The following is perfectly valid C:
while (c = 1) ...;
But probally generates a warning on many C compilers nowdays. C compilers have to determine what is "likely" to be a problem. This a good lesson for Pascalers. We were blessed with a language that does not have such grey areas.
PS. IP Pascal does not have warnings at all. If the option is on to check for problem N, then the occurrance of problem N is an error, end of story. This means the compiler returns an error to the build processor, and in fact deletes any output files, to prevent a false build being created for the bad build.
I agree with the other posters. C warnings are a mess. Avoid at all costs.
While I agree that we're far better off than C, there are dubious areas. Unused parameters, as discussed here, as well as unneed function results, are some.
Even if the compiler always flags them as errors (as GPC will do with `-Werror'), or especially then, there must be a way for the programmer to tell the compiler that in some places, this is intended, and that's what this discussion is for ...
I still prefer adding a built-in `Discard' dummy procedure which will solve both problems, without adding new syntax.
Frank