Re: the & pointer operator to yield an address
- From: "Harald van Dijk" <truedfx@xxxxxxxxx>
- Date: 31 Jan 2007 02:06:55 -0800
Alef.Veld@xxxxxxxxx wrote:
On Jan 31, 1:25 am, gordonb.hr...@xxxxxxxxxxx (Gordon Burditt) wrote:
Often &ptr is passed to func because func is going to store something
in ptr. func(&ptr) is perfectly legal if ptr is uninitialized.
func(ptr) is not.
What happens exactly though if you would do that. It probably just
copy the
'nothingness'/garbage into the new functions argument pointer, making
it
a copy of a unintialized pointer.
You're not supposed to read invalid pointers in C, even if you don't
dereference them. If you do, the implementation is allowed to do
anything it wants. At least one implementation (optionally) uses this
permission to cause the program to warn the user that the code is
buggy, and to provide the user with an option to directly abort the
program.
.
- References:
- the & pointer operator to yield an address
- From: Alef . Veld
- Re: the & pointer operator to yield an address
- From: Gordon Burditt
- Re: the & pointer operator to yield an address
- From: Alef . Veld
- the & pointer operator to yield an address
- Prev by Date: Re: OT: Google's latest dungheap
- Next by Date: Re: OT: Google's latest dungheap
- Previous by thread: Re: the & pointer operator to yield an address
- Next by thread: Re: the & pointer operator to yield an address
- Index(es):
Relevant Pages
|