Game Development Community

Assertions in Unix question.

by Matthew Shapiro · in Technical Issues · 06/29/2002 (6:19 am) · 7 replies

Now asserts in windows bring up a dialog box and tell you the assert, and give you an option to close or ignore. Now my question is about assertions on a Unix platform. I did a bit of research and found out it prints out the assertion error, etc... but it 1) doesn't give an option to ignore, which could be good or bad but, 2) how does this work with X applications?

--KallDrexx

#1
06/29/2002 (9:15 am)
Are you talking about Torque or something else? Torque should pop up a dialog when an assert happens.
#2
06/29/2002 (1:02 pm)
I mean standard asserts, for making any kind of X application

--KallDrexx
#3
06/29/2002 (2:43 pm)
Heh heh, well, X windows is doesn't give you a message box by default, so you have to use some third party to get one, then implement some kind of assert processing on top of that.

Many windowing libraries provide a message box. Qt, gtk, etc. Initially for torque I used the "beautiful" Xaw (X Athena Widgets) library, which is part of almost every X distribution (although interestingly some users still had install it to compile torque). Run xfontsel and you'll get a sample of Xaw's wonderful widgets.
I eventually switched over to my own Xlib based implementation, since Xaw itself required about 4 or 5 extra libraries.

If you look at the x86UNIXMessageBox.cc, you'll see the current xlib based implementation. If you check the logs and go back a few revisions, you'll find the Xaw based implementation.
#4
06/29/2002 (8:12 pm)
I had to install Xaw libs manually but thtat is because I had debian minimum install so...

Any recommendations for 3rd party asserts? How did you do asserts in Unix for torque?

(edit) wow that code looks real simple (for the message box).
--KallDrexx
#5
06/29/2002 (8:30 pm)
Wait, does torque use its own assert method?

--KallDrexx
#6
06/29/2002 (9:02 pm)
Torque has its own assert mechanism (platformAssert). When it needs to display a message box, it asks the platform to do it (Platform::AlertRetry ...)

I haven't used other assert mechanisms, so can't recommend any.

Interesting that you think the message box code is simple...it makes my head hurt every time I look at it. :) It doesn't make very pretty message boxes, but it gets the job done for torque.
#7
06/30/2002 (5:00 am)
lol It looked very straight forward, at least to me. Haven't seen what they look like however.

Then again I learned how to make X code in a day and still think it's easy as crap.

--KallDrexx