[LLVMdev] Clarification between <type> and <ty> for alloca instruction
Tim Northover
t.p.northover at gmail.com
Thu Aug 15 08:12:13 PDT 2013
> I've obviously being playing with C++ too long because my
> instinct immediately told me that dynamically sized arrays on the
> stack are't allowed but apparently that's fine for C99 (g++ also seems
> fine with this is you don't specify -pedantic)
It's all fun and games until someone decides to evaluate sizeof(arr). ;-)
I think a more limited form is coming to C++11, by the way.
> Interesting thanks for clarifying. Now you've raised another question.
> I'm interested to know how you know that this is how overflow behaves
> for this particular instruction. I can imagine several different
> behaviours (I'm assuming NumElements is unsigned but that doesn't seem
> to be specified)
>
> - wrap around overflow. In which case 257 = 255 + 2 so result would be 2
This is what happens (wraparound/truncation/whatever). But I think 256
-> 0, 257 -> 1.
Cheers.
Tim.
More information about the llvm-dev
mailing list