How can I get rid of "Warning C4307: integral constant overflow"

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Microsoft Visual Studio 2005 Version 8.0.50727.762 (SP.050727-7600)

How do I get rid of "Warning C4307: '-' : integral constant overflow" from
the following macro?
#define d_ReturnMax(I_iTypeSize)\
( (int64(1)<<((I_iTypeSize*8)-1))-1)

There NO warnings when done as a function:
int64 d_ReturnMax(int64 I_iTypeSize)
{ return (1<<((I_iTypeSize*8)-1))-1;}

Test code:
int64 L_iMaxIntSize=d_ReturnMax(sizeof(int32)); //
L_iMaxIntSize=0x000000007fffffff
int64 L_iMaxIntSize=d_ReturnMax(sizeof(char)); //
L_iMaxIntSize=0x000000000000007f

I tried typecasting around all parts of code i.e. int64(...)/(int64)... I
give up now.
Can anyone else spot something I have missed?

--
From _Christopher (M2M).
RefCode:44CdccTCDf42 V04
void DeadEnds() {for(;;);} // :)

If replying by email please included ##71; on the subject line followed by
your subject, any post without the ##71; tag WILL be deleted. I.e. "##71;
Thank for the help."


.



Relevant Pages

  • Re: The Chainsaw Infanticide Logger Manuever
    ... a perfectly good method of doing exactly what silence_warnings was written to accomplish ... silence some warnings in test code recently and was thinking about adding it myself. ... What methods are already in ruby to get a "no warnign zone" in cases where I know there are warnings that are not important, and still keep em in the rest of the code? ...
    (comp.lang.ruby)
  • I guess I dont understand modules
    ... This bit of test code works as expected: ... use warnings; ... use strict; ... but when I put that line into a subroutine in my program: ...
    (perl.beginners)
  • Re: How can I get rid of "Warning C4307: integral constant overflow"
    ... Use uint64 in previous line. ... There NO warnings when done as a function: ... int64 d_ReturnMax ... Test code: ...
    (microsoft.public.vc.language)
  • AC_C_CONST bug?
    ... the test code includes some unused variables ... Is this a bug with the macro, ...
    (comp.os.linux.development.apps)
  • selecting column down to variant cell
    ... the next time the macro is run thier maybe 1505 rows in the ... sheet... ... here is a test code that doesn't work for me... ...
    (microsoft.public.excel.programming)