Tim Rentsch <[email protected]> writes:
Keith Thompson <[email protected]> writes:
Andrey Tarasevich <[email protected]> writes:
[...]
#include <stdio.h>
struct S { int a[10]; };
int main()
{
struct S a, b = { 0 };
int *pa, *pb, *pc;
pa = &a.a[5],
pb = &b.a[5],
pc = &(a = b).a[5],
printf("%p %p %p\n", (void *) pa, (void *) pb, (void *) pc);
}
This version has no UB.
I believe it does. [...]
If you look again carefully, I expect you will reach a
different conclusion.
Please explain. Or don't.
I explained, in text that you snipped, why I think it has UB.
If there's a flaw in my reasoning, I invite you to point it out
without being mysterious.
Keith Thompson <[email protected]> writes:
Tim Rentsch <[email protected]> writes:
Keith Thompson <[email protected]> writes:
Andrey Tarasevich <[email protected]> writes:
[...]
#include <stdio.h>
struct S { int a[10]; };
int main()
{
struct S a, b = { 0 };
int *pa, *pb, *pc;
pa = &a.a[5],
pb = &b.a[5],
pc = &(a = b).a[5],
printf("%p %p %p\n", (void *) pa, (void *) pb, (void *) pc);
}
This version has no UB.
I believe it does. [...]
If you look again carefully, I expect you will reach a
different conclusion.
Please explain. Or don't.
I explained, in text that you snipped, why I think it has UB.
If there's a flaw in my reasoning, I invite you to point it out
without being mysterious.
I wasn't thinking about your reasoning or what flaw there may have
been in it. My intention was to suggest a course of action that
would be helpful rather than to point out any sort of mistake. But
since you ask, I think the mistake you made was jumping to a
conclusion without looking carefully enough at the problem.
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,099 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 492373:55:00 |
| Calls: | 14,106 |
| Calls today: | 2 |
| Files: | 187,124 |
| D/L today: |
1,514 files (693M bytes) |
| Messages: | 2,496,031 |