Jump to content
  • Advertisement

Archived

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

kordova

Problem creating own assert()

This topic is 5587 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

Advertisement
Hmmm. Does anyone have a solution that will work? I''ve looked around and I really can''t seem to find an answer aside from those recommendations here.

[edited by - ChildOfKordova on October 11, 2017 10:32:23 AM]
weird

Share this post


Link to post
Share on other sites
See what happens if you change the third parameter by removing "const". It seems to be the cause of your error message.

Good Luck
Code-Junkie

[edited by - Code-Junkie on April 4, 2003 11:02:05 AM]

Share this post


Link to post
Share on other sites
I tried removing either const and both consts but I still receive the same error message. Curses. Thanks though.

[edited by - ChildOfKordova on October 11, 2017 10:32:23 AM]
weird

Share this post


Link to post
Share on other sites
I''ll give this one last bump before I cry myself to sleep.

[edited by - ChildOfKordova on October 11, 2017 10:32:23 AM]
weird

Share this post


Link to post
Share on other sites
i don''t know about your problems with your code, but instead of

exit(1);

i''d do something like

__asm int 3

so you break right into the debugger and see the callstack etc.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
My favourite, PORTABLE, way of generating a run-time break point is:

inline void break() {
*(long *)0 = 0;
}

On older versions of DOS and MacOS classic, this won''t break, but on systems in commercial use today, it will. Most importantly: it will break the same on Windows and Unix, which really are the only two systems that matter anymore. (MacOS X now counts as Unix)

Share this post


Link to post
Share on other sites
For some reason I am confused by this (must be lack of caffeine...)... when exactly would you use that?

[edited by - ChildOfKordova on October 11, 2017 10:32:23 AM]
weird

Share this post


Link to post
Share on other sites
kordova - preprocessor macros are looked down because

a) they do not respect scope
b) they do not guarantee single-evaluation of their parameters
c) they are invisible to the compiler which will report an error in the 'expanded' code, not in the original macro

As such, they can cause a number of nasty bugs.

Here's an article about making a fancy assert. Enjoy.

Edit: The AP's code triggers a segmentation fault as he is dereferencing a null pointer.


[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]


[edited by - Fruny on April 5, 2003 6:55:24 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!