Liste des Groupes | Revenir à cl c |
On 30/05/2025 10:20, David Brown wrote:
>On 29/05/2025 14:38, Richard Heathfield wrote:>
>This really is a very simple point, but perhaps a simple analogy>
will help to clarify it. You don't throw out your 3/4" just
because you've bought a 19mm. There is room for both in the
toolbox, and why write 3/4" on your new spanner? It /isn't/ a
3/4" spanner even though it's very like it, so why pretend
otherwise?
Your analogy does not cover C99 vs C90.
It does if we can construct a program that is legal C90 but not
legal C99, which is easy enough, or (slightly harder but still not
that hard) a program that is legal in both dialects but which
gives different output under C99 than it does for C90.
>
$ cat c9099.c; \
gcc -W -Wall -ansi -pedantic -o c90 c9099.c; \
gcc -o c99 c9099.c; \
./c90; \
./c99
#include <stdio.h>
>
int main(void)
{
int a = 42;
>
int b = a //* comment */ 6;
;
printf("Soln = %d\n", b);
>
return 0;
}
Soln = 7
Soln = 42
Obviously it's a contrived example, but then examples pointing out
the consequences of language differences invariably are.
Les messages affichés proviennent d'usenet.