From: John Stone (johns_at_ks.uiuc.edu)
Date: Sat Jan 12 2013 - 06:18:10 CST

John,
  Indeed, that line of code appears to have gotten mangled at some
point during development. It should be rewritten like this:

long volmemtexszkb = volmemszkb + ((voltexmap != NULL) ? 3*volmemszkb : 0);

Cheers,
  John Stone
  vmd_at_ks.uiuc.edu

On Thu, Jan 10, 2013 at 09:08:22PM -0600, John Jumper wrote:
> When compiling the source for VMD on OS X Lion using clang, I
> encountered the warning below. I am not familiar at all with this
> source, but the code written certainly looks like a bug due to
> mistaken operator precedence. Please disregard if I am not correct.
>
> Compiling QuickSurf.C --> QuickSurf.o ...
> QuickSurf.C:531:58: warning: operator '?:' has lower precedence than
> '+'; '+' will be evaluated first [-Wparentheses]
> long volmemtexszkb = (volmemszkb + (voltexmap != NULL) ? 3*volmemszkb : 0);
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
> QuickSurf.C:531:58: note: place parentheses around the '+' expression
> to silence this warning
> long volmemtexszkb = (volmemszkb + (voltexmap != NULL) ? 3*volmemszkb : 0);
> ^
> ( )
> QuickSurf.C:531:58: note: place parentheses around the '?:' expression
> to evaluate it first
> long volmemtexszkb = (volmemszkb + (voltexmap != NULL) ? 3*volmemszkb : 0);
> ^
> ( )
> 1 warning generated.
>
> Best regards,
> John Jumper

-- 
NIH Center for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
http://www.ks.uiuc.edu/~johns/           Phone: 217-244-3349
http://www.ks.uiuc.edu/Research/vmd/       Fax: 217-244-6078