Re: a debug question


[ Follow Ups ] [ Post Followup ] [ CS1704 Discussion WWWBoard ] [ FAQ ]

Posted by hussein on July 15, 2000 at 00:59:50:

In Reply to: a debug question posted by sabrina on July 14, 2000 at 21:14:26:

: _ASSERT(*file!=_T('\0'));
: I do not know what the sentence means when I
: debug my program.

hmmm ... i had to look up the help for _T but it is in there (thankfully) ...

apparently, _T does nothing except allow for unicode extensions - if you dont know what that is, dont worry - for our purposes it does nothing.
"*file", as you know, dereferences the pointer called "file", then checks to see if it is unequal to the '0' character - probably meaning that the character array pointed to by "file" must be non-empty.

_ASSERT provides a mechanism to make assertions ... ie make statements about what absolutely has to be true at that point in the program - if it is not true, the program will exit with an appropriate error in the debugger ...

this entire statement is a debugging tool to check for errors ... in your final program, if you check for errors, you ought not to have your program quit upon finding an empty filename ... but do something else that is a "nice" way of recovering from the error ...




Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ CS1704 Discussion WWWBoard ] [ FAQ ]