python (12.9k questions)
javascript (9.2k questions)
reactjs (4.7k questions)
java (4.2k questions)
java (4.2k questions)
c# (3.5k questions)
c# (3.5k questions)
html (3.3k questions)
Strict aliasing rule for character pointer C++
I am trying to understand the strict aliasing rule. By reading the answer to What is the strict aliasing rule , I have some further questions. Here I borrow the example from that post:
struct Msg { ui...
user2961927
Votes: 0
Answers: 1
restrict qualifier placement with pointers to pointers
Here are a couple of C and POSIX functions that need to fetch some data from or put some data into a buffer and tell the caller how much, so they take a pointer to the starting buffer address and writ...
Alex Shpilkin
Votes: 0
Answers: 1
Why would the C standard (whatever is the latest) forbid this program due to strict aliasing?
It is clear to me that the C standard forbids (does not define the behavior of) this program, but it is not clear why it has to be this way. Why are the aliasing rules such that one cannot write this ...
anonymouscoward
Votes: 0
Answers: 5
Shouldn't strict-aliasing kick in in this code?
Take this toy code:
void f(const int& a, int* dat) {
for (int i=0; i<a; ++i )
dat[i] += a;
}
Observe that the compiler is afraid that dat[i] might alias with a, i.e. writing to ...
Ofek Shilon
Votes: 0
Answers: 2