Buffer error 
Author Message
 Buffer error

Hi,

I am trying to detect this type of errors, thanks in
advance.

int Tabla[100];
int *p;

void CPruebaView::OnButton1()
{
   #ifdef _DEBUG
     CMemoryState oldMemState, newMemState, diffMemState;
     oldMemState.Checkpoint();
   #endif

   p = Tabla;
   Tabla[100] ++;    // ????????? ERROR TO DETECT
   Tabla[150] = 100; // ????????? ERROR  TO DETECT

   (*p) = 100;

   #ifdef _DEBUG
      newMemState.Checkpoint();
      if( diffMemState.Difference( oldMemState,
ewMemState ) )
      {
         TRACE( "Memory leaked!\n" );
      }
    #endif

Quote:
}



Sat, 17 Jan 2004 00:11:08 GMT  
 Buffer error
Hi
I'm afraid it is difficult to detect this kind of error. It is not memory
leak, so it's no use check the error this way.

I think you need to check the array boundary manually. Also, you can use
try(?-) catch block to trap the errors. If you get the Access Violations at
run time, you may want to check the information below about debugging:

Q133174 How to Locate Where a General Protection (GP) Fault Occurs
http://support.microsoft.com/support/kb/articles/q133/1/74.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcco...
ML/_core_how_can_i_debug_an_access_violation.3f.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcco...
ML/_core_how_can_i_debug_access_violations_when_running_my_program_standalon
e.3f.asp

Regards,
Leo



Sat, 17 Jan 2004 15:12:50 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Help! Unable to create file buffer error

2. Help! Unable to create file buffer error

3. WinSock Send Buffer error.. HELP!!

4. WinSock Send Buffer error.. HELP!!

5. error opening 16th buffered file

6. Error PRJ0002 - Buffer overrun detected ...

7. Error in Buffer allocation

8. "Unable to Create File Buffer" error

9. ODBC error: Unable to create file buffer

10. ODBC to SQLServer: Error Unable to write to file buffer

11. ODBC to SQLServer: Error Unable to write to file buffer

12. buffer and &buffer

 

 
Powered by phpBB® Forum Software