Re: printf() behavior
- From: Barry Schwarz <schwarzb@xxxxxxxx>
- Date: Wed, 11 Aug 2010 21:57:28 -0700
On Thu, 12 Aug 2010 13:04:55 +0900, "Mark"
<mark_cruzNOTFORSPAM@xxxxxxxxxxx> wrote:
"pete" <pfiland@xxxxxxxxxxxxxx> wrote in message
news:4C635E51.6299@xxxxxxxxxxxxxxxxx
Is the first statement legitimate?
N869
6.3.2.3 Pointers
[#6] Any pointer type may be converted to an integer type.
Except as previously specified, the result is
implementation-defined. If the result cannot be represented
in the integer type, the behavior is undefined. The result
need not be in the range of values of any integer type.
Am I right that in "1" b is evaluated to
address of string literal?
No.
Then who is right, you or Ian Collins (see his answer up the thread) ?
There is no conflict between the two.
In responding to the first question, both say possibly, providing
certain conditions are satisfied. The only difference is the
terminology used.
For the second question, b is an int and therefore does not hold any
address. Only pointers hold addresses. Since the conversion from
pointer to int is implementation-defined (6.3.2.3-6), a definitive
answer can be had only in relation to a specific implementation.
--
Remove del for email
.
- References:
- printf() behavior
- From: Mark
- Re: printf() behavior
- From: pete
- Re: printf() behavior
- From: Mark
- printf() behavior
- Prev by Date: Re: printf() behavior
- Next by Date: Re: (OT) Re: "claim", etc. (was Re: C Standard Regarding Null Pointer Dereferencing)
- Previous by thread: Re: printf() behavior
- Next by thread: What happens on stack when a function calls another one
- Index(es):
Relevant Pages
|