-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathNutzTransformation04.c
46 lines (44 loc) · 1.1 KB
/
NutzTransformation04.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//#Safe
// Test for Alex's treatment of unsigned ints which does the modulo computation
// not after each operation but
// - before comparisons (this includes relational operators, equality
// operators and checks if a value is (un)equal to zero)
// - before conversions to signed data types,
// - before casts to unsigned data types if the resulting data type has a
// larger size, and
// - before division and modulo operations.
// Author: [email protected]
// Date: 2015-11-22
#include <stdio.h>
int main() {
if (sizeof(short) == 2) {
unsigned short a = (unsigned short) -65536;
// a is 0 but -65536 in our representation
printf("%u\n",a);
int b = !a;
//@ assert b == 1;
int c = a && 1;
//@ assert c == 0;
int d = a || 0;
//@ assert d == 0;
int e = (a ? 5 : 17);
//@ assert e == 17;
if (a) {
//@ assert \false;
}
while(a) {
//@ assert \false;
break;
}
// for (;;a) {
// //@ assert \false;
// break;
// }
int i=0;
do {
i++;
} while (a);
//@ assert i == 1;
}
return 0;
}