Articles   Members Online: 3
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
My Assertion Handler Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
12-Sep-03
Category
Algorithm
Language
Delphi 5.x
Views
65
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Erwin Molendijk

How do you implement your own handler for assertion failures?

Answer:

1   program AssertDemo;
2   {
3     Copyright (c) 2001 by E.J.Molendijk
4     Delphi Factory Netherlands BV
5   
6     This little program demonstrates the use
7     of your own assertion handler.
8     Check out the AssertErrorHandler() procedure in SysUtils.pas to
9     see how borland has implemented their (far more complex) handler.
10  }
11  
12  uses
13    Dialogs;
14  
15  procedure MyAssertErrorHandler(const message, Filename: string;
16    LineNumber: Integer; ErrorAddr: Pointer);
17  begin
18    ShowMessageFmt(
19      'This is my own assertion handler for %s line %d: %s',
20      [Filename, LineNumber, message]);
21    // you could save the information to a file or something...
22  end;
23  
24  begin
25    AssertErrorProc := @MyAssertErrorHandler;
26    assert(false, 'assertion failure test');
27  end.


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC