rapp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Rapp-dev] assert(!error_return) if --enable-debug?


From: Johan Almbladh
Subject: Re: [Rapp-dev] assert(!error_return) if --enable-debug?
Date: Tue, 12 Apr 2011 12:44:08 +0200

As a general principle of library design I think functions should check their arguments and return an error code if invalid rather than to abort: "assert on internal consistency checks and return error codes on faulty user input". It would then be up to the calling library or program to validate its own arguments, and then assert on rapp error codes (that it then knows should not fail).

As a debug build option it is maybe another matter. However, it would change the semantics of the API compared to the production build.

/Johan

On Mon, Mar 28, 2011 at 6:04 PM, Hans-Peter Nilsson <address@hidden> wrote:
How about adding asserts that the exported functions succeed (as
in not returning an error code)?

Users here have several layers of libraries.  When just updating
RAPP and running unit tests from the upmost layers, those tests
have been known to fail.  A quick way to check whether it's a
failing RAPP call or Something Else would help usability.
Right, they could find all middle-libraries and (find and)
enable their debug options, but that doesn't really improve
usability.

Should it be covered by a separate --enable- option or just be
gated on --enable-debug?

The RAPP test-suite tests that verify that the proper error code
is returned would have to be #if'd away, probably with an #else
#warning "Tests verifying error codes are disabled", so I'm
leaning towards a separate --enable- option, perhaps
--enable-asserted-returns (default disabled); better names
welcome.

brgds, H-P



reply via email to

[Prev in Thread] Current Thread [Next in Thread]