Esempio n. 1
0
struct delicious* skip_external_function(void) {
  struct delicious* cake = NULL;
  int i;

  if (bakery(&cake) == NULL) {
    return 0;
  }

  i = cake->yum;
  return cake;
}
Esempio n. 2
0
struct delicious* returnPassByRef2() {
  struct delicious* param = NULL;
  bakery(&param);
  int i = param->yum; // should not report a warning
  return param;
}
Esempio n. 3
0
void by_ref_actual_already_in_footprint2(struct delicious* param) {
  int i;
  i = param->yum; // should not report a warning
  struct delicious* ret = bakery(&param);
  i = param->yum; // should not report a warning
}
Esempio n. 4
0
void by_ref_actual_already_in_footprint(struct delicious* param) {
  int i;
  struct delicious* ret = bakery(&param);
  i = param->yum;
}
Esempio n. 5
0
int main(int argc, char *argv[], char *envp[]) 
{
    int RValue = false;
    int CaptureModeHex = 0;
    int NewChar=0;
    int nResult = 0;
    int arraySize = 2000;

    printf ("main - start\n");
    
    const char* ClassFileNaMe = "allegro.log";    
    // signal(SIGSEGV, posix_death_signal);
    
    // printHex(ClassFileNaMe);
    // segfault();
        
    throw_error t_err;
    //Exp _exp;
    // _exp.run();
    /*
    try
    {
        // func( 10 );
        fall_in_file();
    }
    catch ( const std::exception& msg )
    // catch ( const char* msg)
    {
        std::cout << "Application had exception handling with message: ";
        // std::cout << msg;
        printf ("%s\n", msg.what());
        std::cout << "-------------------" << strerror(errno);
        //return 1;
    }
    catch (...)
    {
        cout << "Unknown Error!!!!" << std::endl;
        std::cout << "-------------------" << strerror(errno);
        
    }*/

    
    //std::stringstream ss;
    std::auto_ptr <Auto> bakery(new Auto());
    char* pleak = new char[1024]; // might be lost => memory leak
    __try
    {
        //fault_simple();
        //fall();
        //t_err.Run();
        // open_my_file();
        
        // fall_in_file(); // call an exception        
        delete [] pleak; // will only get here if x == 0. if x!=0, throw exception
    }
    __except (EXCEPTION_EXECUTE_HANDLER)
    {
        std::cout << "-------------------" << strerror(errno);        
        // memento();
    } 
    /* */
    
#ifdef YS_TEST213413_B    
    
    try
    {
        //my_exceptions m_ex;
        //m_ex.run();
        //fault_simple();
        // t_err->Run();
        // open_my_file();
        
    }
    catch (std::runtime_error _str_error)
    {
        std::cout << _str_error.what();
        throw;
    }
    catch (DivideByZeroError err)
    {
        cout << "ERROR: ";
        err.printMesage();
        cout << endl;
        return 1;
    }
    catch (...)
    {
        cout << "Unknown Error!!!!" << std::endl;
    }
#endif    
    //*************MAIN LOOP*****************//
    cout << "\n$ > Press any key to exit." << std::endl;

    do 
    {
        //This is simple Windows way:
        Sleep(55);
        // control of endless loop (may be also in monitor.cpp)
        if (_kbhit())  // has anything been pressed from keyboard ?
        {
                NewChar=(unsigned char)_getch();
                RValue = true;
                if ((NewChar & 0xff) == 24)  // CTRL-X   pressed
                {
                    RValue = true; // END mark
                }     
                if (NewChar == 'd')  // pressed
                {
                    if (1 == CaptureModeHex) 
                        CaptureModeHex = 1;
                    else
                        CaptureModeHex = 0;
                }
            }
        } while (!RValue);  
        printf ("Application complete.\n");
    
        _CrtDumpMemoryLeaks();
        return 0;
}