Hi all,

 

I was reading through some of the RAM cache code and stumbled across this:

 

http://svn.apache.org/repos/asf/incubator/trafficserver/traffic/branches/dev
/iocore/cache/RamCache.cc

 

int

RamCache::get_lock(INK_MD5 * key, Ptr<IOBufferData> *ret_data, EThread * t,
inku32 auxkey1, inku32 auxkey2)

{

  inku32 k = key->word(3);

  int pp = k % n_partitions;

  RamCachePartition *p = &partition[pp];

  (void) p;   // ???

  CACHE_TRY_LOCK(l, p->lock, t);

 

Or something similar:

 

int
RamCache::put(INK_MD5 * key, IOBufferData * data, EThread * t, inku32
auxkey1, inku32 auxkey2)
{
 
  /* equivalent to ram cache disabled */
  if (partition_size == 0)
    return 0;
 
  ProxyMutex *mutex = t->mutex;
  (void) mutex;  // ???
  inku32 k = key->word(3);

 

I'm wondering what's its (the seemingly no-op void casts) purpose?  Is it a
long, lost holdover from some previous compiler version which required a
statement like that to keep it quiet for some warning?  I've seen it in
several different files.

 

Just curious...didn't know if this was some obscure trick I was unaware of -
other than quieting a compiler to say a variable's unreferenced...

 

Thanks,

D.J. Stachniak

 

Reply via email to