K
kuyper
Richard said:kuyper said: ....
I'm just trying to imagine what kind of bozo would alias a data buffer
with a stream pointer.
Um, yeah, okay, maybe it's not so hard to imagine. Sturgeon and all
that. I retract the "misplaced".
I agree that Sturgeon's law is the most reason why such code might be
written; and I believe that alone is sufficient reason to apply the
qualifiers.
However, Sturgeon's law is not the only way this issue could come up..
I can easily imagine legitimate, though non--portable, reasons why
someone might do something like that. If they understood the
implementation-specific details about how a FILE structure is layed
out and used by the implementation, I could imagine wanting to save
that information to a strean (which might be the same stream) for
later examination. By that same token, of course, if they understood
enough to want to do that, they should also understand enough to know
why it's unsafe to do it that way; the best that can be done is to
save a copy of the FILE structure, rather than the one in actual use.
Therefore, Sturgeon's Law remains the most likely cause of such code.