Manta Interactive Ray Tracer Development Mailing List

Text archives Help


Re: [MANTA] unnamed in PointVector


Chronological Thread 
  • From: Christiaan Paul Gribble <cgribble@sci.utah.edu>
  • To: manta@sci.utah.edu
  • Subject: Re: [MANTA] unnamed in PointVector
  • Date: Tue, 24 May 2005 15:27:44 -0600

Placing the "typedef" keyword in front of the declaration may make those
warnings go away, but still allow the compiler to bail if Dim != 3.

C

James Bigler wrote:
> This is exactly why I brought it up.  I can't see the real warnings from
> the swarms of these ones.
> 
> James
> 
> Abe Stephens wrote:
> 
>> 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.

Top of page