-
-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make size_t/ptrdiff_t match pointer size on 8/16 bit architectures
- Loading branch information
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// A minimal test wrt. size_t on a 16-bit architecture. | ||
|
||
// REQUIRES: target_AVR | ||
// RUN: %ldc -mtriple=avr -betterC -c %s | ||
|
||
static assert(size_t.sizeof == 2); | ||
static assert(ptrdiff_t.sizeof == 2); | ||
|
||
// test bounds checks | ||
int foo(int[] arr) | ||
{ | ||
return arr[1]; | ||
} |