source: src/Clight/test/addptrcharboth.c @ 2569

Last change on this file since 2569 was 2569, checked in by campbell, 8 years ago

Fix Clight semantics for ptr + char. (Compiler works anyway.)

File size: 315 bytes
Line 
1int diffu(char *p, char *q, unsigned char i) {
2  p = p + i;
3  return p - q;
4}
5
6int diffs(char *p, char *q, signed char i) {
7  p = p + i;
8  return p - q;
9}
10
11char arr[280];
12
13int main(void) {
14  char *p = arr;
15  int x,y;
16  x = diffu(p+20, p, 241);
17  y = diffs(p+20, p, -15);
18  return x + y; /* 40 + 241 - 15 = 266 */
19}
Note: See TracBrowser for help on using the repository browser.