- ASSERT fault?

From: Marco Ciot <"Marco>
Date: Sun, 11 Jun 2006 10:56:56 +0200

----boundary-LibPST-iamunique-1762321158_-_-
Content-type: text/plain

It would be inconvenient if ASSERT(FALSE) wouldn't raise an error at compile
time already.

I often place ASSERT statements like:

ASSERT(LEN(array) >= maxItemCnt);

And of course I want the compiler to let me know immediately that the
assertion fails.

The intention of using ASSERT is never to HALT, but to assert a condition
for the subsequent program code. In other words: if a program is correct no
ASSERT in it will ever fail (and neither will any type guard). This is why
it is possible to drop the time consuming checks with a compiler option.

The conclusion is that if you place debugging statements in the code to
cause halts you should always use HALT and not ASSERT.
E.g.:
        IF a = 10 THEN HALT(99) END;
and not:
        ASSERT(a # 10, 99);

Marco Ciot



-----Original Message-----
From: blackbox{([at]})nowhere.xy
Software
Sent: Sunday, June 11, 2006 04:48
To: BlackBox Mailing List
Subject: [BlackBox] - ASSERT fault?


This question arose in the process of porting some code from Gardens
Point Component Pascal to Blackbox Component Pascal.

The following statement:

  ASSERT(FALSE)

Results in the compiler error: 'ASSERT fault'

Why? I haven't been able to find any reason in the Component Pascal
Language Reference why it should not be allowed.

Chris Burrows
CFB Software
http://www.cfbsoftware.com/gpcp

--- BlackBox
--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy

--- BlackBox
--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy



----boundary-LibPST-iamunique-1762321158_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"

e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwX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ZSBhbGxvd2VkLlxwYXINClxwYXINCkNocmlzIEJ1cnJvd3NccGFyDQpDRkIgU29mdHdhcmVccGFy
DQpodHRwOi8vd3d3LmNmYnNvZnR3YXJlLmNvbS9ncGNwXHBhcg0KXHBhcg0KLS0tIEJsYWNrQm94
XHBhcg0KLS0tIHNlbmQgc3ViamVjdCBIRUxQIG9yIFVOU1VCU0NSSUJFIHRvIGJsYWNrYm94QG9i
ZXJvbi5jaFxwYXINClxwYXINCi0tLSBCbGFja0JveFxwYXINCi0tLSBzZW5kIHN1YmplY3QgSEVM
UCBvciBVTlNVQlNDUklCRSB0byBibGFja2JveEBvYmVyb259fQBpb3JpdHk6IE5vcm1h


----boundary-LibPST-iamunique-1762321158_-_---
Received on Sun Jun 11 2006 - 10:56:56 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:27:51 UTC