#25 secblock.h has assignment in while (MSVC 2005)

None
accepted
None
5
2015-06-08
2007-10-26
No

Index: secblock.h

--- secblock.h (revision 1385)
+++ secblock.h (revision 1386)
@@ -102,7 +102,7 @@
{
byte *p;
#ifdef CRYPTOPP_MM_MALLOC_AVAILABLE
- while (!(p = (byte *)_mm_malloc(sizeof(T)*n, 16)))
+ while ((p = (byte *)_mm_malloc(sizeof(T)*n, 16)) == 0)
#elif defined(CRYPTOPP_MEMALIGN_AVAILABLE)
while (!(p = (byte *)memalign(16, sizeof(T)*n)))
#elif defined(CRYPTOPP_MALLOC_ALIGNMENT_IS_16)
@@ -123,7 +123,7 @@
}

pointer p;
- while (!(p = (pointer)malloc(sizeof(T)*n)))
+ while ((p = (pointer)malloc(sizeof(T)*n)) == 0)
CallNewHandler();
return p;
}

Principally, Microsoft decided you need to specifically compare value with something, only a ! will not work to remove the warning.

Discussion

  • Jeffrey Walton

    Jeffrey Walton - 2015-06-08
    • status: open --> accepted
    • assigned_to: Jeffrey Walton
    • Group: -->
     
  • Jeffrey Walton

    Jeffrey Walton - 2015-06-08

    I can't duplicate this warning. Can you provide more details (like a reference to an MS blog)?

    Its been so long, we will probably close it. But I like a clean compile, so I don't want to close it too soon.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks