Keith H Duggar <dug...@alum.mit.edu> writes:

> On Sep 29, 9:01 pm, RG <rnospa...@flownet.com> wrote:
>> That the problem is "elsewhere in the program" ought to be small
>> comfort.  But very well, try this instead:
>>
>> [...@mighty:~]$ cat foo.c
>> #include <stdio.h>
>>
>> int maximum(int a, int b) { return a > b ? a : b; }
>>
>> int main() {
>>   long x = 8589934592;
>>   printf("Max of %ld and 1 is %d\n", x, maximum(x,1));
>>   return 0;}
>>
>> [...@mighty:~]$ gcc -Wall foo.c
>> [...@mighty:~]$ ./a.out
>> Max of 8589934592 and 1 is 1
>
> $ gcc -Wconversion -Werror foo.c
> cc1: warnings being treated as errors
> foo.c: In function 'main':
> foo.c:5: warning: passing argument 1 of 'maximum' with different width
> due to prototype
>
> It's called "learning to compile". And, yes, those warnings (and
> nearly
> every other one) should be enabled and treated as errors if a shop
> wants
> maximum protection. I only wish more (library) vendors did so.

So you're wishing that they'd be active by default.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to