----boundary-LibPST-iamunique-1343191860_-_-
Content-type: text/plain
> -----Original Message-----
> From: blackbox{([at]})nowhere.xy> Behalf Of Marco Ciot
> Sent: Sunday, 11 June 2006 6:27 PM
> To: BlackBox Mailing List
> Subject: [BlackBox] - ASSERT fault?
>
>
> 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);
>
OK, thanks - I see the benefit of that. The earlier a problem is
detected the easier it is to fix. However, that only applies in a
limited number of situations - i.e. when the expression can be evaluated
at compile-time.
> And of course I want the compiler to let me know immediately that the
> assertion fails.
>
Note that, with reference to your example above, the compiler can only
let you know *immediately* if 'array' has been declared with static
dimensions. If 'array' is declared as a POINTER to AnArray, or 'array'
is an open-array parameter then the expression cannot be evaluated until
runtime.
> 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);
>
Your conclusion is not one that I would agree with. It also does not
seem to be supported by the Oms documentation relating to the
recommended use of assertions.
Regards,
Chris
Chris Burrows
CFB Software
http://www.cfbsoftware.com/gpcp
--- BlackBox
--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy
----boundary-LibPST-iamunique-1343191860_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xm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