Opened 15 years ago

Closed 15 years ago

#105 closed defect (wontfix)

remove asserts in header files

Reported by: Peter Owned by: Peter
Priority: major Milestone: yat 0.3 (Public release)
Component: classifier Version: trunk
Keywords: Cc:

Description

I don't think it's good style to have asserts in header files. The reason is simply that if you have installed the lib without sanity checks then you expect the yat to don perform any sanity check. This is not the case for the assert in the header files as this code is compile post-installation. See Stroustrup for further discussion.

Change History (7)

comment:1 Changed 15 years ago by Peter

(In [619]) fixes #107 and refs #105 fixed bug in EnsembleBuilder? and removed some assert in header files

comment:2 Changed 15 years ago by Peter

After all asserts in headerfiles e.g. in access operators are quite efficient in tracking down bugs. However using the standard assert is not optimal as the user should be able to turn on and off that with -DNDEBUG without affecting the nehaviour of the library. A compromise could be to implement our own assert function (see Stroustrup for details) and these are turned on/off with something like #define YAT_ASSERT and by default these are turned of but running configure with some developer flag the YAT_ASSERT is turned on.

Just an idea. What do you think?

comment:3 Changed 15 years ago by Jari Häkkinen

Milestone: later0.3 (Public release)

comment:4 Changed 15 years ago by Jari Häkkinen

Is the decision to go with YAT_ASSEERT?

comment:5 in reply to:  4 ; Changed 15 years ago by Peter

Replying to jari:

Is the decision to go with YAT_ASSEERT?

Obviously, I think it is the way to go.

comment:6 in reply to:  5 Changed 15 years ago by Jari Häkkinen

Replying to peter:

Replying to jari:

Is the decision to go with YAT_ASSEERT?

Obviously, I think it is the way to go.

In a code base without inline functions there would not be a need for YAT_ASSERT! However, we still have inline functions.

Anyhow, I think we should go for YAT_ASSERTs with documentation for how to use it.

comment:7 Changed 15 years ago by Jari Häkkinen

Resolution: wontfix
Status: newclosed

This issue will go away once ticket:170 is fixed.

Note: See TracTickets for help on using tickets.