Thanks you all for your answers, they were really helpful. It seems
that 6.3.2.3 wasn't all.
Although it's quite off-topic, could you tell me what that
"ISO/IEC 1999:TC3" is worth? Can I take it as a reference? If so, is
there a similar reference for C89?
On May 6, 2:37 pm, Eric Sosman <esos...@[EMAIL PROTECTED]
> wrote:
> Even in C89 you could printf a void* value with "%p". You
> could also scanf it with "%p" (matching a void**), but the result
> was not usefully defined. C99 (or maybe an intermediate revision)
> tightened the language to require that the round-trip must succeed
> if everything was valid to begin with, the program hasn't exited,
> the pointed-to location is still valid, and so on.
Thanks a lot for the idea, I haven't even considered it. I've
actually never used any scanf-like function. I don't like using
things I don't understand, and these functions looks a little bit
like magic to me. I will dig into that direction.
Now that I think about it, I made the mistake of only considering
giving the pointer to the user as an int, while actually I want to
give it as a printable string.
> I can understand why you'd want to display pointer values as
> a debugging aid, but it seems peculiar to want to read them back
> again. Chancy, too: An innocent typo arouses the nasal demons.
I don't know if it's a usual or good way to do it, but I like to
test parts of my programs "by hand", without any input santization
and as little processing as possible (I want to test the part of
my program, not the draft-input I put on it for testing/debugging
purpose). In these cases, an "innocent typo" only means that I
can't deduce anything from the test, which isn't that bad (though
I should probably consider myself lucky to encounter only program
segfaults as manifestations of undefined behaviour, and not e.g.
large-scale nuclear explosions).


|