On Tuesday, 14 January 2020 at 12:05:01 UTC, John Burton wrote:
After years of C++ I have become paranoid about any casting of
pointers being undefined behavior due to aliasing so want to
see if :-
FWIW, this is safe and portable in C++20:
https://en.cppreference.com/w/cpp/numeric/bit_cast
After years of C++ I have become paranoid about any casting of
pointers being undefined behavior due to aliasing so want to see
if :-
1) This is safe to do in D.
2) If not is there anything I can do to make it safe.
3) If not, what is the best approach?
I have a void* pointing to a block of
what is the equivalent for this code in D?
#include stdio.h
main()
{
struct S { int i; };
struct S s, *s_ptr;
s_ptr = s;
s_ptr-i = 9;
printf(%d\n, s_ptr-i);
}
On 17/04/2011 18:17, %u wrote:
what is the equivalent for this code in D?
#includestdio.h
main()
{
struct S { int i; };
struct S s, *s_ptr;
s_ptr =s;
s_ptr-i = 9;
printf(%d\n, s_ptr-i);
}