Skip to content
Prev 32835 / 63424 Next

as.numeric(levels(factor(x))) may be a decreasing sequence

Martin Maechler wrote:
[...]
this can cause severe problems even without concurrency, as one of my
examples hinted.
absolutely.  again, ER is unsafe even in a sequential execution environment.
telepathy?
but it should be made clear, by means of a comment, that ER is supposed
to be used in this way.  there is no hint at the interface level.
unless you know a powerful and willing magician.
the first line appears inessential;  to an informed programmer, taking a
string as char* (as opposed to const char*) means that it *may* be
modified within the call, irrespectively of whether it actually is, and
on what occasions, and one should not assume the string is not
destructively modified.

i think it is much more appropriate to comment (a) ER, with a warning to
the effect that it always returns the same address, hence the output
should be used immediately and never written to, (b) the use of ER in
SFR where it's output is cast to char* precisely for the purpose of
destructive modification, to the contrary of what (a) says.

i've attached a patch with an alternative comment.
almost
indeed.  unfortunately, ER is callable from throughout the place.
"if i'm correct"
what does it have to do with ER returning a pointer to a static location?
surprisingly, sometimes i'm able to notice ;)

best,
vQ
-------------- next part --------------
A non-text attachment was scrubbed...
Name: coerce.diff
Type: text/x-diff
Size: 1106 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20090531/f692e569/attachment.bin>