assert(0) not working in 1.4.0 ?

Post Reply
a128
Posts: 3
Joined: Mon Jan 11, 2010 11:36 am

assert(0) not working in 1.4.0 ?

Post by a128 » Wed Jan 13, 2010 12:48 pm

It seems that

Code: Select all

#include <assert.h>

//did I need this to show the assert(0)?!!!
consoleDemoInit();
	
assert(0);
is not working anymore..I know that this worked before

User avatar
vuurrobin
Posts: 219
Joined: Fri Jul 11, 2008 8:49 pm
Location: The Netherlands
Contact:

Re: assert(0) not working in 1.4.0 ?

Post by vuurrobin » Wed Jan 13, 2010 4:13 pm

maybe you're confusing assert with libnds's sassert().

http://libnds.devkitpro.org/a00097.html

I suggest you try that.

a128
Posts: 3
Joined: Mon Jan 11, 2010 11:36 am

Re: assert(0) not working in 1.4.0 ?

Post by a128 » Thu Jan 14, 2010 10:26 am

vuurrobin wrote:maybe you're confusing assert with libnds's sassert().

http://libnds.devkitpro.org/a00097.html

I suggest you try that.
ok..thanks sassert() is kind of assert() but it takes an additional paramter

assert(0) is ok
sassert(0,"a bug") needs 2 paras

WinterMute
Site Admin
Posts: 2003
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: assert(0) not working in 1.4.0 ?

Post by WinterMute » Tue Jan 19, 2010 8:23 pm

That's a bit odd, it certainly used to work. Can you file that as a bug & I'll take a look when I get a chance.

http://sourceforge.net/tracker/?func=de ... tid=668551
Help keep devkitPro toolchains free, Donate today

Personal Blog

WinterMute
Site Admin
Posts: 2003
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: assert(0) not working in 1.4.0 ?

Post by WinterMute » Sun Jul 25, 2010 12:30 pm

Should have posted a bug report & I might have remembered this much sooner :p

Anyway, there were two things affecting the assert code - 1. Dovoto removed the stderr hook from the default console when he added the debug output redirection which meant that nothing would be output and 2. When I added the exit to menu code more recently the DS would shut down or return to hbmenu on an assertion so you wouldn't have a chance to read it.

This works with latest libnds.

Code: Select all

#include <nds.h>
#include <stdio.h>

#include <assert.h>

// function to pause on exit, called on non zero exit code
void systemErrorExit(int rc) {
	printf("exit with code %d\n",rc);

	while(1) {
		swiWaitForVBlank();
		scanKeys();
		if (keysDown() & KEY_A) break;
	}
	
}

//---------------------------------------------------------------------------------
int main(int argc, char **argv) {
//---------------------------------------------------------------------------------
	consoleDemoInit();
	
	assert(0);

	while(1) {
		swiWaitForVBlank();
		scanKeys();
		if (keysDown() & KEY_X) break;
	}
	return 42;
}
Help keep devkitPro toolchains free, Donate today

Personal Blog

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest