From: santosh on
On Thursday 19 Jul 2007 11:05 pm, Herbert Kleebauer <klee(a)unibwm.de>
wrote in message <469FA0D6.7B942A11(a)unibwm.de>:

> santosh wrote:
>
>
>> Just don't post the source to comp.lang.c. ;-)
>
> What's wrong with comp.lang.c?

Many folks in clc are what one might call "pedants". They also
believe in writing C code that, if possible, emits no diagnostics
even when compiled under strictest diagnostic and Standard
conformance checking.

If windela.c is compiled with the command line:

gcc -Wall -Wextra -std=c99 -pedantic -o lindela windela.c

gcc emits the following diagnostics before successful compilation:

santosh(a)sapphire:~/tmp/windela$
gcc -Wall -Wextra -std=c99 -pedantic -o lindela windela.c
windela.c:152: warning: return type defaults to ?int?
windela.c: In function ?main?:
windela.c:168: warning: implicit declaration of
function ?print_string?
windela.c:216: warning: implicit declaration of function ?ende?
windela.c:222: warning: implicit declaration of function ?ins_lab?
windela.c:263: warning: implicit declaration of function ?get_opcode?
windela.c:264: warning: implicit declaration of function ?cmps?
windela.c:267: warning: implicit declaration of function ?skip_line?
windela.c:311: warning: implicit declaration of function ?read_eol?
windela.c:317: warning: implicit declaration of function ?list_label?
windela.c:324: warning: implicit declaration of
function ?get_operand?
windela.c:328: warning: implicit declaration of function ?get_w?
windela.c:347: warning: implicit declaration of
function ?dec_boperand?
windela.c:353: warning: implicit declaration of function ?aus_byte?
windela.c:361: warning: implicit declaration of function ?adr_pre?
windela.c:362: warning: implicit declaration of function ?seg_pre?
windela.c:364: warning: implicit declaration of function ?mod__sib?
windela.c:374: warning: implicit declaration of function ?mod_sib?
windela.c:395: warning: implicit declaration of
function ?dec_operand?
windela.c:403: warning: implicit declaration of function ?aus_word?
windela.c:403: warning: implicit declaration of function ?aus_long?
windela.c:979: warning: implicit declaration of function ?get_wert?
windela.c:1470: warning: implicit declaration of function ?trans?
windela.c:1649: warning: suggest parentheses around && within ||
windela.c:1715: warning: suggest parentheses around && within ||
windela.c:2000: warning: suggest parentheses around assignment used
as truth value
windela.c:2043: warning: suggest parentheses around assignment used
as truth value
windela.c:2203: warning: suggest parentheses around assignment used
as truth value
windela.c:2226: warning: suggest parentheses around assignment used
as truth value
windela.c:3257: warning: suggest parentheses around && within ||
windela.c:3399: warning: suggest parentheses around && within ||
windela.c: In function ?adr_pre?:
windela.c:5142: warning: suggest parentheses around && within ||
windela.c:5144: warning: suggest parentheses around && within ||
windela.c:5145: warning: suggest parentheses around && within ||
windela.c:5146: warning: control reaches end of non-void function
windela.c: In function ?seg_pre?:
windela.c:5156: warning: ?return? with no value, in function
returning non-void
windela.c:5157: warning: ?return? with no value, in function
returning non-void
windela.c:5158: warning: ?return? with no value, in function
returning non-void
windela.c: In function ?out_byte?:
windela.c:5184: warning: implicit declaration of function ?print_dec?
windela.c:5178: warning: unused variable ?p?
windela.c:5188: warning: control reaches end of non-void function
windela.c: In function ?aus_byte?:
windela.c:5196: warning: implicit declaration of function ?list_char?
windela.c:5197: warning: implicit declaration of function ?list_byte?
windela.c:5204: warning: control reaches end of non-void function
windela.c: In function ?aus_word?:
windela.c:5223: warning: control reaches end of non-void function
windela.c: In function ?aus_long?:
windela.c:5245: warning: control reaches end of non-void function
windela.c: In function ?list_byte?:
windela.c:5278: warning: control reaches end of non-void function
windela.c: In function ?list_char?:
windela.c:5288: warning: control reaches end of non-void function
windela.c: In function ?trans?:
windela.c:5305: warning: control reaches end of non-void function
windela.c: In function ?mod_sib?:
windela.c:5313: warning: control reaches end of non-void function
windela.c: In function ?mod__sib?:
windela.c:5484: warning: control reaches end of non-void function
windela.c: In function ?get_wert?:
windela.c:5493: warning: suggest parentheses around assignment used
as truth value
windela.c:5496: warning: control reaches end of non-void function
windela.c: In function ?get_w?:
windela.c:5568: warning: implicit declaration of function ?buchzahl?
windela.c:5569: warning: implicit declaration of function ?get_zahl?
windela.c:5611: warning: operation on ?j? may be undefined
windela.c:5611: warning: operation on ?j? may be undefined
windela.c:5612: warning: operation on ?j? may be undefined
windela.c:5612: warning: operation on ?j? may be undefined
windela.c:5613: warning: operation on ?j? may be undefined
windela.c:5613: warning: operation on ?j? may be undefined
windela.c:5614: warning: operation on ?j? may be undefined
windela.c:5614: warning: operation on ?j? may be undefined
windela.c:5615: warning: operation on ?j? may be undefined
windela.c:5615: warning: operation on ?j? may be undefined
windela.c:5616: warning: operation on ?j? may be undefined
windela.c:5616: warning: operation on ?j? may be undefined
windela.c:5617: warning: operation on ?j? may be undefined
windela.c:5617: warning: operation on ?j? may be undefined
windela.c:5618: warning: operation on ?j? may be undefined
windela.c:5618: warning: operation on ?j? may be undefined
windela.c:5619: warning: operation on ?j? may be undefined
windela.c:5619: warning: operation on ?j? may be undefined
windela.c:5620: warning: operation on ?j? may be undefined
windela.c:5620: warning: operation on ?j? may be undefined
windela.c:5621: warning: operation on ?j? may be undefined
windela.c:5621: warning: operation on ?j? may be undefined
windela.c:5622: warning: operation on ?j? may be undefined
windela.c:5622: warning: operation on ?j? may be undefined
windela.c:5623: warning: operation on ?j? may be undefined
windela.c:5623: warning: operation on ?j? may be undefined
windela.c:5624: warning: operation on ?j? may be undefined
windela.c:5624: warning: operation on ?j? may be undefined
windela.c:5625: warning: operation on ?j? may be undefined
windela.c:5625: warning: operation on ?j? may be undefined
windela.c:5626: warning: operation on ?j? may be undefined
windela.c:5626: warning: operation on ?j? may be undefined
windela.c:5627: warning: operation on ?j? may be undefined
windela.c:5628: warning: operation on ?j? may be undefined
windela.c: In function ?get_zahl?:
windela.c:5692: warning: implicit declaration of function ?buchst?
windela.c:5696: warning: implicit declaration of function ?get_lab?
windela.c: In function ?get_operand?:
windela.c:5710: warning: implicit declaration of function ?read_char?
windela.c:5711: warning: ?return? with no value, in function
returning non-void
windela.c:5714: warning: implicit declaration of function ?del_blank?
windela.c:5708: warning: unused variable ?j?
windela.c: In function ?del_blank?:
windela.c:5737: warning: suggest parentheses around && within ||
windela.c:5737: warning: suggest parentheses around && within ||
windela.c:5740: warning: control reaches end of non-void function
windela.c: In function ?dec_boperand?:
windela.c:5752: warning: ?return? with no value, in function
returning non-void
windela.c: In function ?dec_operand?:
windela.c:5765: warning: ?return? with no value, in function
returning non-void
windela.c:5776: warning: ?return? with no value, in function
returning non-void
windela.c:5782: warning: ?return? with no value, in function
returning non-void
windela.c:5785: warning: implicit declaration of function ?finds?
windela.c:5791: warning: ?return? with no value, in function
returning non-void
windela.c:5801: warning: ?return? with no value, in function
returning non-void
windela.c:5812: warning: ?return? with no value, in function
returning non-void
windela.c:5821: warning: ?return? with no value, in function
returning non-void
windela.c:5833: warning: ?return? with no value, in function
returning non-void
windela.c:5846: warning: ?return? with no value, in function
returning non-void
windela.c:5857: warning: ?return? with no value, in function
returning non-void
windela.c:5866: warning: ?return? with no value, in function
returning non-void
windela.c:5879: warning: ?return? with no value, in function
returning non-void
windela.c:5884: warning: ?return? with no value, in function
returning non-void
windela.c:5895: warning: ?return? with no value, in function
returning non-void
windela.c:5905: warning: ?return? with no value, in function
returning non-void
windela.c:5915: warning: ?return? with no value, in function
returning non-void
windela.c:5931: warning: ?return? with no value, in function
returning non-void
windela.c:5942: warning: ?return? with no value, in function
returning non-void
windela.c:5953: warning: ?return? with no value, in function
returning non-void
windela.c:5964: warning: ?return? with no value, in function
returning non-void
windela.c:5980: warning: ?return? with no value, in function
returning non-void
windela.c:5986: warning: ?return? with no value, in function
returning non-void
windela.c:5998: warning: ?return? with no value, in function
returning non-void
windela.c:6004: warning: ?return? with no value, in function
returning non-void
windela.c:6017: warning: ?return? with no value, in function
returning non-void
windela.c:6023: warning: ?return? with no value, in function
returning non-void
windela.c:6036: warning: ?return? with no value, in function
returning non-void
windela.c:6042: warning: ?return? with no value, in function
returning non-void
windela.c:6049: warning: ?return? with no value, in function
returning non-void
windela.c:6055: warning: ?return? with no value, in function
returning non-void
windela.c:6060: warning: ?return? with no value, in function
returning non-void
windela.c:6067: warning: ?return? with no value, in function
returning non-void
windela.c:6072: warning: ?return? with no value, in function
returning non-void
windela.c:6078: warning: ?return? with no value, in function
returning non-void
windela.c:6084: warning: ?return? with no value, in function
returning non-void
windela.c:6090: warning: ?return? with no value, in function
returning non-void
windela.c:6095: warning: ?return? with no value, in function
returning non-void
windela.c:6100: warning: ?return? with no value, in function
returning non-void
windela.c:6105: warning: ?return? with no value, in function
returning non-void
windela.c:6110: warning: ?return? with no value, in function
returning non-void
windela.c:6115: warning: ?return? with no value, in function
returning non-void
windela.c:6120: warning: ?return? with no value, in function
returning non-void
windela.c:6128: warning: ?return? with no value, in function
returning non-void
windela.c:6136: warning: ?return? with no value, in function
returning non-void
windela.c:6141: warning: ?return? with no value, in function
returning non-void
windela.c:6146: warning: ?return? with no value, in function
returning non-void
windela.c:6154: warning: ?return? with no value, in function
returning non-void
windela.c:6162: warning: ?return? with no value, in function
returning non-void
windela.c:6170: warning: ?return? with no value, in function
returning non-void
windela.c:6177: warning: ?return? with no value, in function
returning non-void
windela.c:6178: warning: ?return? with no value, in function
returning non-void
windela.c:6179: warning: ?return? with no value, in function
returning non-void
windela.c:6180: warning: ?return? with no value, in function
returning non-void
windela.c:6181: warning: ?return? with no value, in function
returning non-void
windela.c:6182: warning: ?return? with no value, in function
returning non-void
windela.c:6188: warning: suggest parentheses around assignment used
as truth value
windela.c:6194: warning: ?return? with no value, in function
returning non-void
windela.c: In function ?finds?:
windela.c:6217: warning: suggest explicit braces to avoid
ambiguous ?else?
windela.c: In function ?ins_lab?:
windela.c:6340: warning: suggest explicit braces to avoid
ambiguous ?else?
windela.c:6351: warning: suggest parentheses around assignment used
as truth value
windela.c:6358: warning: control reaches end of non-void function
windela.c: In function ?list_label?:
windela.c:6405: warning: control reaches end of non-void function
windela.c: In function ?skip_line?:
windela.c:6435: warning: control reaches end of non-void function
windela.c: In function ?read_eol?:
windela.c:6457: warning: ?return? with no value, in function
returning non-void
windela.c: In function ?read_char?:
windela.c:6469: warning: implicit declaration of function ?get_char?
windela.c: In function ?get_char?:
windela.c:6498: warning: suggest explicit braces to avoid
ambiguous ?else?
windela.c: In function ?ende?:
windela.c:6570: warning: implicit declaration of function ?exit?
windela.c:6570: warning: incompatible implicit declaration of
built-in function ?exit?
windela.c:6516: warning: unused variable ?p?
windela.c: In function ?print_dec?:
windela.c:6588: warning: control reaches end of non-void function
windela.c: In function ?print_string?:
windela.c:6597: warning: control reaches end of non-void function
santosh(a)sapphire:~/tmp/windela$

This will be considered simply *awful* in clc. :)

From: Herbert Kleebauer on
santosh wrote:

> If windela.c is compiled with the command line:
>
> gcc -Wall -Wextra -std=c99 -pedantic -o lindela windela.c
>
> gcc emits the following diagnostics before successful compilation:

Very funny warnings. I always use int instead of void (because
then you can use the implicit declaration) and just return nothing.

There is only one real warning:

> windela.c:5611: warning: operation on ?j? may be undefined

But this shouldn't be flaged as a warning but as an error.

case 0x05: {la[--j] = la[j] / la[j+1]; break;}

With this code, Windela shouldn't work properly when compiled
with GCC on a SUN (but this was my first C program and you only
learn by making errors).


> This will be considered simply *awful* in clc. :)

I would consider the warning-system of GCC *awful*.
From: santosh on
On Friday 20 Jul 2007 2:36 am, Herbert Kleebauer <klee(a)unibwm.de>
wrote in message <469FD26C.18F2A0F3(a)unibwm.de>:

> santosh wrote:
>
>> If windela.c is compiled with the command line:
>>
>> gcc -Wall -Wextra -std=c99 -pedantic -o lindela windela.c
>>
>> gcc emits the following diagnostics before successful compilation:
>
> Very funny warnings. I always use int instead of void (because
> then you can use the implicit declaration) and just return nothing.
>
> There is only one real warning:
>
>> windela.c:5611: warning: operation on ?j? may be undefined
>
> But this shouldn't be flaged as a warning but as an error.
>
> case 0x05: {la[--j] = la[j] / la[j+1]; break;}

Why should this be an error? This exhibits undefined behaviour, but
that doesn't mean compilation should be stopped.

> With this code, Windela shouldn't work properly when compiled
> with GCC on a SUN (but this was my first C program and you only
> learn by making errors).

Why only on the SUN? This code should invoke undefined behaviour on
all implementations, since 'j' is modified more than once between
sequence points.

>> This will be considered simply *awful* in clc. :)
>
> I would consider the warning-system of GCC *awful*.

Well just don't say this clc. You'll never hear the end of the
story. :)

From: T.M. Sommers on
santosh wrote:
> On Friday 20 Jul 2007 2:36 am, Herbert Kleebauer <klee(a)unibwm.de>
> wrote in message <469FD26C.18F2A0F3(a)unibwm.de>:
>
>>But this shouldn't be flaged as a warning but as an error.
>>
>> case 0x05: {la[--j] = la[j] / la[j+1]; break;}
>
> Why should this be an error? This exhibits undefined behaviour, but
> that doesn't mean compilation should be stopped.
>
>>With this code, Windela shouldn't work properly when compiled
>>with GCC on a SUN (but this was my first C program and you only
>>learn by making errors).
>
> Why only on the SUN? This code should invoke undefined behaviour on
> all implementations, since 'j' is modified more than once between
> sequence points.

I only see j being modified once.

--
Thomas M. Sommers -- tms(a)nj.net -- AB2SB

From: T.M. Sommers on
Herbert Kleebauer wrote:
>
> Very funny warnings. I always use int instead of void (because
> then you can use the implicit declaration) and just return nothing.

Just because you always do it does not mean that it is conforming
C. Just because you get away with it today does not mean that
you will tomorrow. Implicit int is no longer a part of the
language. Neither is a non-void function not having a return.

--
Thomas M. Sommers -- tms(a)nj.net -- AB2SB

First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Prev: masm linking from console
Next: NASM HelloWorld - DOS