Capture return codes from library functions

C (and POSIX) library functions often communicate error conditions in a two stage procedure: first the return value of the function is set to a special value (such as 0 for malloc) and then the caller can read the particular error condition from the pseudo-variable errno.

This “traditional” error handling has several disadvantages:

  • Code that captures all returns from library functions with conditional code quickly becomes unreadable. Optically such code emphasizes on the error handling part, instead of the normal control flow.
  • errno is a fragile thing, and in particular after it has been set by a transient error, it must be reset to 0.

P99 now lets you overload functions with appropriate macros for the error check, and that if an error occurs will either abort execution or throw an error via P99’s P99_TROW.

Continue reading “Capture return codes from library functions”

Drop out: there is not opt out button for dropbox

Recently someone sent me a “share” request on dropbox and used one of my email addresses that is not yet linked to that service, and for which I don’t want to ever use dropbox. I then redirected that person to use another mail account for that, and the person did. Everything fine, so far.

But then days later dropbox kindly reminded me that there was this request pending. I guess that spam would have gone on for a while, if I hadn’t stopped it.

So I went to the dropbox site to opt out of their service for this particular email. It took me a while to realize that the expectation that there might exist just a little button for that was far too naive, there is no such thing on their site. I am sure that technically such a button would not be much of a problem, basically just the same as subscribing for such a service. (You’d have to verify the email, somehow.)

So I had to go through their “help” system, which took actually two entire days until I got through to a human. Finally they put that mail address on a black list.

In summary not too good an experience as a “non-user”. I already would rate the services that they offer to real customers relatively bad:

  • pro: a file sharing service, even free of charge for all the use I had for now
  • contra: ridiculous management of access rights:
    • it allow your “friends” to inadvertently delete your files when “moving” them on their laptop disk, instead of copying them
    • It allows your friends to silently accumulate GigaBytes of files on your hard disk, by collecting files in shared directories that basically are never cleaned up. (currently 3.4 GiB on my hard disk)
  • contra: no encryption or data protection

I will probably think again before I send an “invite” to share some files on dropbox, this might be a real privacy intrusion.