Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » BETA status handling
BETA status handling [message #52397] Wed, 18 September 2019 15:18 Go to next message
koldo is currently offline  koldo
Messages: 3004
Registered: August 2008
Ultimate Member
Hello all

When having an application in beta status, there is a big risk of having ASSERTs called in Release mode binaries.

I propose you to add a new flag like BETA, so the ASSERT could be reconverted into throw Exc() or other way so that the software can handle the error, instead of just crashing abruptly the software. Last is a terrible user experience.

What do you think?


Best regards
Iñaki
Re: BETA status handling [message #52398 is a reply to message #52397] Wed, 18 September 2019 15:40 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12050
Registered: November 2005
Ultimate Member
ASSERTs are not active in release mode.

Mirek
Re: BETA status handling [message #52400 is a reply to message #52398] Wed, 18 September 2019 17:26 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3004
Registered: August 2008
Ultimate Member
This is the reason I propose an intermediate BETA status, where ASSERTs could be handled by software trying to catch the problems.
In beta, after an ASSERT, a warning window is ugly, but a software crash is much worse.


Best regards
Iñaki

[Updated on: Wed, 18 September 2019 17:27]

Report message to a moderator

Re: BETA status handling [message #52401 is a reply to message #52400] Wed, 18 September 2019 18:24 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12050
Registered: November 2005
Ultimate Member
koldo wrote on Wed, 18 September 2019 17:26
This is the reason I propose an intermediate BETA status, where ASSERTs could be handled by software trying to catch the problems.
In beta, after an ASSERT, a warning window is ugly, but a software crash is much worse.


Maybe we could introduce Panic hook so that you can install throw routine there?
Re: BETA status handling [message #52402 is a reply to message #52401] Wed, 18 September 2019 18:47 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3004
Registered: August 2008
Ultimate Member
That could be great.
It could catch all ASSERT and panic conditions that cost time to be checked (and are void in Release mode), to throw something to be catch at higher level.
This could be set by a flag, so normal Release binaries would not suffer the drawback of, for example, having to check the bounds of any access to a container.


Best regards
Iñaki

[Updated on: Wed, 18 September 2019 18:48]

Report message to a moderator

Re: BETA status handling [message #52466 is a reply to message #52402] Thu, 03 October 2019 16:10 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12050
Registered: November 2005
Ultimate Member
koldo wrote on Wed, 18 September 2019 18:47
That could be great.
It could catch all ASSERT and panic conditions that cost time to be checked (and are void in Release mode), to throw something to be catch at higher level.
This could be set by a flag, so normal Release binaries would not suffer the drawback of, for example, having to check the bounds of any access to a container.


Actually, it is there for ages:

InstallPanicMessageBox

That one gets called on Panic, so putting throw there (instead of displaying the error, or in addition to doing so) should do exactly what you need...

Mirek
Re: BETA status handling [message #52478 is a reply to message #52466] Sun, 06 October 2019 13:56 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3004
Registered: August 2008
Ultimate Member
Thank you Mirek. However that is not exactly the same.

InstallPanicMessageBox() and SetAssertFailedHook() let to install panic handlers.

However, in case of the ASSERTs, this only works in DEBUG mode. Please check this code in Defs.h:

#ifdef _DEBUG
	#define ASSERT_(x, msg)  ((x) ? (void)0 : ::Upp	::AssertFailed(__FILE__, __LINE__, msg))
	#define ASSERT(x)        ASSERT_(x, #x)
#else
	inline  void LOGNOP__() {}
	#define LOG_NOP          Upp::LOGNOP__()
	#define ASSERT_(x, msg)  LOG_NOP
	#define ASSERT(x)        LOG_NOP
#endif
Out of DEBUG, ASSERTs seem to do nothing, as are disconnected to AssertFailed().


Best regards
Iñaki
Re: BETA status handling [message #52484 is a reply to message #52478] Mon, 07 October 2019 10:23 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12050
Registered: November 2005
Ultimate Member
Yes, that is the principal difference between DEBUG and RELEASE.

What you are asking for here is to make RELEASE behave as DEBUG. Why not use DEBUG then?

Mirek
Re: BETA status handling [message #52488 is a reply to message #52484] Tue, 08 October 2019 09:19 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3004
Registered: August 2008
Ultimate Member
Hello Mirek

Release version is faster and smaller.
However, do not worry. This is not an important issue.


Best regards
Iñaki
Re: BETA status handling [message #52491 is a reply to message #52488] Tue, 08 October 2019 10:30 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12050
Registered: November 2005
Ultimate Member
koldo wrote on Tue, 08 October 2019 09:19
Hello Mirek

Release version is faster and smaller.
However, do not worry. This is not an important issue.


Release version is faster and smaller exactly because all those ASSERTs are not being checked Smile

Other than that, you can configure things to optimize debug in exactly same way as release.

Mirek
Re: BETA status handling [message #52492 is a reply to message #52491] Tue, 08 October 2019 16:54 Go to previous message
koldo is currently offline  koldo
Messages: 3004
Registered: August 2008
Ultimate Member
I am sorry to disagree with you. I bet you the difference in speed between a RELEASE version with ASSERTS with throws, and a DEBUG version, is already very significant Smile

However, do not worry. This is not an important issue.


Best regards
Iñaki
Previous Topic: C2280 with Vector
Next Topic: Doubt about container
Goto Forum:
  


Current Time: Thu Oct 17 12:04:11 CEST 2019

Total time taken to generate the page: 0.01211 seconds