[PATCH] do not call _dbus_warn_check_failed on checks

Thiago Macieira thiago at kde.org
Tue Nov 14 12:07:17 PST 2006

Daniel Stone wrote:
>How do I know, looking at a function, if an error can occur, witout
>reading the documentation?

Just by looking at a function you can tell. A function like:

void dbus_foo();
	cannot fail

dbus_bool_t dbus_foo();
	can fail and returns true or false if it failed
	or it can't fail and returns true or false as its value

int dbus_foo();
	returns a value. If said value has a range, then any value out of the 
range means error.

But you're more likely to find the case of returning values as:
dbus_bool_t dbus_foo(dbus_bool_t *);
dbus_bool_t dbus_foo(int *);
	which returns success or failure in the return value and the value in the 

The third form:
dbus_bool_t dbus_foo(..., DBusError *);
	is found whenever an error that isn't OOM is possible

But, I have to say, if you're relying on *guessing* what a function does 
instead of reading its documentation, you're doing it wrong. On the other 
hand, expecting similar behaviour *is* correct: if we use one paradigm in 
D-Bus, we should use it in all functions.

  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20061114/934a4724/attachment.pgp

More information about the dbus mailing list