Archived

This topic is now archived and is closed to further replies.

Some wierd Assertion error (?)

This topic is 5674 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. Can some one tell me what this means: What does this mean? What causes it? How can I fix it? I have no idea what this assertion stuff is. All i can tell you is that when i press ignore, the program performs an illegal op. When in debug, it crashes after a bitmap loading function. If you need a look at that or any other stuff in my code please say. thx, -J [edited by - jason2jason on June 3, 2002 7:50:24 PM] [edited by - jason2jason on June 3, 2002 7:53:54 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Jason2Jason
Hi. Can some one tell me what this means:

<img src="http://193.203.245.211/um.JPG">

What does this mean? What causes it? How can I fix it? I have no idea what this assertion stuff is. All i can tell you is that when i press ignore, the program performs an illegal op. When in debug, it crashes after a bitmap loading function. If you need a look at that or any other stuff in my code please say.

thx,

-J

<SPAN CLASS=editedby>[edited by - jason2jason on June 3, 2002 7:50:24 PM]</SPAN>

<SPAN CLASS=editedby>[edited by - jason2jason on June 3, 2002 7:53:54 PM]</SPAN>


Assert is a common macro that can be found in just about any C/C++ implementation. What does it do? Well basically it tosses up a message box if the value is 0. Here is an example:

int value = 0;
assert(value);

Why is this useful? Well many functions in the C library as well as C++ library return 0 if they fail, an example of this would be:

FILE *filepointer;
filepointer = fopen("bitmap.bmp","rb";
assert(filepointer);

If the function can not locate "bitmap.bmp" it will return 0, otherwise it returns a pointer to the file. The assert tells the programmer if the function worked or not.

In all likelyhood the function that''s called before the assert is failing for some reason, you should look into that by stepping through the debugger.


Share this post


Link to post
Share on other sites