Given that we've been over the rename(2) behaviour-copying and so on, I thought I'd hijack part of this thread for a more abstract discussion:
I first came across this argument in Maguire's Writing Solid Code book. His example (and mine) was a wrapper for C's malloc(3) and friends, for instance, to detect memory leaks. You can call stdlib realloc with a NULL pointer, in which case it acts like malloc, or with a zero size, in which case it acts like free. Maguire argues that in almost every case, NULL-pointer or zero-size calls to realloc are errors rather than clever tricks. Accordingly, he removed this behaviour from his realloc wrapper. I did the same when I wrote a realloc wrapper, for the same reasons.
In general, I tend to think that duplicating broken behaviour in the interests of familiarity is a bad idea. The question, then, becomes: "Is rename's behaviour broken, or just unexpected?"
--
F
o
x
t
r
o
t
U
n
i
f
o
r
m
Found a typo in this node? /msg me
% man 3 strfry
In reply to Re: A DWIM too far?
by FoxtrotUniform
in thread A DWIM too far?
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |