Text archives Help
- From: Christiaan Paul Gribble <cgribble@sci.utah.edu>
- To: James Bigler <bigler@cs.utah.edu>
- Cc: "'manta@sci.utah.edu'" <manta@sci.utah.edu>
- Subject: Re: [MANTA] unnamed in PointVector
- Date: Tue, 24 May 2005 15:15:48 -0600
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.