It's also responsible for approximately 300 warning messages (yellow, not red flags) if you turn on all of the warnings (which cmake or xcode decided to do by default)..
Abe
Christiaan Paul Gribble wrote:
Looks like a compile-time check on the dimensionality of the vector to
me. Anyway, it reminds me of Andrew's trick for the scratchpad size
that floated on the cs6620 list last spring:
template<typename T>
const T* HitRecord::getScratchpad(void) const {
// Compile time check
typedef char unused[(sizeof(T)<=MAX_SCRATCHPAD_SIZE)?1:0];
return reinterpret_cast<const T*>(scratch);
}
In this case, if Dim == 3, char unnamed[1] will be a valid (but ignored)
variable, and if Dim != 3, char unnamed[0] will throw up a red flag...
C
James Bigler wrote:
What is the purpose of unnamed in PointVector.h? It doesn't seem to be
referenced. Here's an example from line 22:
VectorT(T x, T y, T z) {
char unnamed[ Dim == 3 ? 1 : 0 ];
data[0] = x; data[1] = y; data[2] = z;
}
Thanks,
James
Archive powered by MHonArc 2.6.16.