Keith said:
MrG{DRGN} wrote: [...]
[...] If not then is there any portable usefulness for %p in
printf?
No ... C is not a portable language, and this is merely one example of
why its not. This is just meant for system-level debugging. By
knowing what the %p format does on your system, you may be able to
understand what its output means, and that's all you really have.
Your statement, "C is not a portable language", is either meaningless
or false.
MrG{DRGN}, who claims to be a person new to C, asked the following
question:
[...] is there any portable usefulness for %p in printf?
Why do you think he's asking that? He has either some expectation, or
has read some propaganda somewhere suggesting that C is a portable
language. He sees this and realizes that its a blatant contradiction
of this notion. Being a new programmer to C, he has no stake in this.
He hasn't cherry picked some case to make C look bad. Its a
contradiction and that motivates him to ask the question.
And as you well know, there is an endless supply of these
"contradictions" for the C language. Your position, is to modify the
notion of portability, rather than simply accepting the mountain of
examples (each one by itself being sufficient) that basically tell you
that "C" is not, by itself, portable.
The question of whether C, as a language, is "portable" could mean any
of a number of things. If you measure portability by the number of
platforms on which it's been implemented,
Mutating the definition ... the word you are looking for is
"availability".
[...] I suspect that C is more portable than any other programming language.
No, by that measure assembly is more portable.
[...] If you're talking about
portability of C programs, it's entirely possible to write C programs
that are portable to any conforming implementation.
Its possible to write Fortran, BASIC, and Pascal programs that are also
portable as well. Its also possible to write programs which are
portable to multiple programming languages too (look up polygots).
Writing portable code in C is perhaps more work than writing portable
code in some other languages. Writing non-portable code in C is easy
to do deliberately, and perhaps too easy to do unintentionally.
Inferring from this that "C is not a portable language" is nonsense.
Ok, so you are saying, by that reasoning, that Fortran, BASIC and
Pascal are similarly portable languages then?
Or perhaps I've misunderstood your statement; can you clarify it?
Well, I think you just misunderstand the content of MrG{DRGN}'s
question. He's asking how can C be considered portable if %p formating
doesn't have portable semantics.
Why do you think stdint.h was added to the C99 standard? If C were a
portable language, why would anyone need such a file? The file should
basically be called "PortableIntegers.h" because that's what it is --
because the old C never hada portable integers. How is a language
supposed to be considered portable without portable integers?
For those that cannot let go of the notion that C is portable, you
simply mutate the meaning of portable and say that its ok for %p to be
different, and that doesn't affect portability. Its much like the
dogmatic religious who sit on the notions they believe and simply
mutate the world, science, logic, around them so that they can retain
their belief in the rightness of their religion.