code question

JD jd1008@gmail.com
Thu Sep 27 01:18:00 GMT 2012


I came across this patch which could be cause of a bug.

What are possible side effects of this
code segment if compiled under various
non-gnu C compilers, and GCC compilers?

 >+inline uint32_t NS_MIN(uint32_t a, uint64_t b)
 >+{
 >+  return b < a ? b : a;
 >+}
Nit: Please cast the 64-bit variable to 32-bit in case compilers start 
warning about it.

 >+      *pProgress = NS_MIN<PRUint64>(totalBytes - bytesLeft, 
PR_UINT32_MAX);

Thanx.



More information about the Gcc-help mailing list