In my understanding, if we call buffer_append(&x, &y) for x.bytes and
y.bytes pointing to overlapping areas of the same array, we get UB by
the first two parameters of memcpy being restrict-qualified pointers.
implications in the absence of restrict. Various ways of implemeting a memcpy-like function will produce various unexpected results when
objects overlap, even without any undefined behavior taking place. For instance if we copy byte-by-byte, from lowest address to highest, then
we end up writing into memory that our loop is about to read from,
corrupting the data.
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,097 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 21:15:02 |
| Calls: | 14,089 |
| Files: | 187,111 |
| D/L today: |
1,314 files (438M bytes) |
| Messages: | 2,490,428 |