Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4589654
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T22:06:47+00:00 2026-05-21T22:06:47+00:00

I have a Visual Studio 2008 Windows Mobile 6.5.3 ARMV4I project. I check for

  • 0

I have a Visual Studio 2008 Windows Mobile 6.5.3 ARMV4I project. I check for out of memory conditions using a try/catch block looking for std::bad_alloc exceptions. But, through testing I’ve found that it can actually just return a NULL value and not throw an exception.

int _tmain( int argc, _TCHAR* argv[] )
{
    int i = 0;

    try
    {
        for( ; i < 30000; ++i )
        {
            BYTE* f = new BYTE[1024];
            if( NULL == f )
            {
                NKDbgPrintfW( L"NULL - Survived %d iterations\r\n", i );
                break;
            }
        }
    }
    catch( std::bad_alloc& )
    {
        NKDbgPrintfW( L"std::bad_alloc - Survived %d iterations\r\n", i );
    }

    return 0;
}

This prints: NULL - Survived 29599 iterations.

I am not linking against nothrownew.obj and according to this I should expect a std::bad_alloc exception . http://msdn.microsoft.com/en-us/library/kftdy56f%28v=VS.90%29.aspx

Does anybody know what’s going on?

Thanks,
PaulH

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T22:06:48+00:00Added an answer on May 21, 2026 at 10:06 pm

    What you observe simply means that the library supplied with the compiler is broken. It is broken in a sense that it does not follow the requirements of C++ language standard.

    This particular issue with new has been present in the earlier versions of C++ standard library (like the one supplied with VC 6.0). Later some versions of the compiler/library were updated to satisfy standard requirements. Apparently, the Windows Mobile version was left unchanged.

    It is quite possible that it was done intentionally in order to preserve the compatibility with older code. You might also wanna check for some compiler configuration switch that might control this behavior. I don’t know whether such a switch exists.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Visual Studio 2008 Windows Mobile 6 C++ application that is using
I have a Visual Studio 2008 C++ Windows Mobile 6 application where I'm using
I have a Windows Mobile/Pocket PC project in Visual Studio 2008 SP1. I have
I have a Visual Studio 2008 C++ Windows Mobile 6.5 project where I would
I have a Visual Studio 2008 C++ project for Windows Mobile 6 with two
I have developed a Windows service using Visual Studio 2008. I want to install
I have a Windows Forms project in Visual Studio 2008, which references a library
Using Visual Studio 2008, c#, .net 2.0. I have a Windows Forms client application
I have a Visual Studio 2008 C# .NET 3.5 project using MySql 5.1.53 and
I'm developing an application for Windows Mobile Devices using Visual Studio .NET 2008 whose

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.