Liste des Groupes | Revenir à l c |
Consider the following program:There are not much remaining big-endian architectures today.
#include <stdio.h>
#include <string.h>
typedef unsigned long long ULL;
ULL hello = ((((0ULL +'o' <<8) +'l' <<8) +'l' <<8) +'e' <<8) + 'h';
int
main(){
printf( "length is %zu\n", strlen( (char*)&hello ) );
return 0;
}
On a little endian machine (with CHAR_BIT == 8) this program works,
and TTBOMK conforms to both the letter and the spirit of the C
standard, without any undefined behavior (on that platform). Yet
there are no arrays in sight, and certainly no array objects.
Les messages affichés proviennent d'usenet.