Boost logo

Boost :

From: Valentin Bonnard (Bonnard.V_at_[hidden])
Date: 1999-08-31 12:43:48


The debate about assert ran very quickly: I got answers
to previous messages in my mailbox before I even had time
to type the message 9there were more than 16 messages sent
today about assertions !).

With so many contributions, things tend to get confusing
for people who haven't followed all the debate with a
lot of care.

So, let me summarize:

General comments:

- no one here wants to discourage the use assertions

- boost might provide an alternative to the standard
  assert macro

The macro issue:

- in order to report file/line information, the
  assertion has to be a macro

- macros are not good citizens, and are
  often best avoided in favor of inline
  function/constants/templates

The behaviour issue:

- throwing an exception (logic_error) is more C++-ish

- halting is harder to ignore

- producing a core dump helps debugging

The granularity issue:

- we would want to be able to turn assertion
  on or off more precisely than per TU

- the TU granularity often breaks the ODR (see
  below)

The ODR:

- the ODR requires that inline/template functions are
  defined the same way in all TU

- it means that for assertions to be usable in
  inline/template functions, then must be TU-independant

- for <cassert> it means that NDEBUG should get the
  same value in all TUes

- easily enforcable policies are preferred, so

- being able to specify in exactly one place the
  activation/desactivation of assertions is prefered

-- 
Valentin Bonnard

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk