www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Null checks for structs and

reply Erik Charlebois <erikcharlebois gmail.com> writes:
Is there a way to disable the checks for 'this == null' at the beginning of
struct methods?

Similarly, is there a way to disable static array bounds checking? I'm trying
to write a light weight vector class template and running into some problems
with these.

Oddly, gcc isnt able to optimize away the static bounds checking even though it
seems rather obvious statically comparing 0 against 2...

	xorl	%edx, %edx
	xorl	%ecx, %ecx
	cmpl	$2, %edx
	leal	0(,%ecx,4), %esi
	fstps	-28(%ebp)
	jae	L1454
Mar 09 2007
parent reply Henning Hasemann <hhasemann web.de> writes:
On Fri, 09 Mar 2007 14:58:44 -0500
Erik Charlebois <erikcharlebois gmail.com> wrote:

 Is there a way to disable the checks for 'this == null' at the beginning of
struct methods?
 
Did you try -release already? That should at least disable bounds checking for arrays. Henning -- v4sw7Yhw4ln0pr7Ock2/3ma7uLw5Xm0l6/7DGKi2e6t6ELNSTVXb7AHIMOen5a2Xs5Mr2g5ACPR hackerkey.com
Mar 09 2007
parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Henning Hasemann" <hhasemann web.de> wrote in message 
news:20070309221454.cab3e7ce.hhasemann web.de...
 Did you try -release already?
 That should at least disable bounds checking for arrays.
It does, and it also turns off the struct null check, asserts (other than assert(false)s), invariants, in/out contracts, debug statements, and just about any other debugging cruft. Would be nice if there were a bit more granularity for turning these things on and off, though..
Mar 09 2007