Re: why use -> (not .) with pointers?
- From: jacob navia <jacob@xxxxxxxxxxxxxxxx>
- Date: Thu, 30 Jun 2005 15:21:16 +0200
Felix Kater wrote:
Hi,
when accessing the variables in a struct: What's the reason why in C you have -> and . instead of only . ? Are there cases in which the compiler couldn't figure out what to do?
Felix
I think the answer is NO, there aren't any reasons why the distinction exists since the compiler can always figure it out.
If we would always use '.' and there was a pointer, the compiler could test if we have instead of a structure, a pointer to a structure, then generate a dereferencing of the pointer without much trouble.
The best way to do this is to deprecate '->'
But, helas, this is not going to happen any time soon.
jacob
.
- Follow-Ups:
- Re: why use -> (not .) with pointers?
- From: CBFalconer
- Re: why use -> (not .) with pointers?
- From: Lawrence Kirby
- Re: why use -> (not .) with pointers?
- References:
- why use -> (not .) with pointers?
- From: Felix Kater
- why use -> (not .) with pointers?
- Prev by Date: Re: why use -> (not .) with pointers?
- Next by Date: Re: why use -> (not .) with pointers?
- Previous by thread: Re: why use -> (not .) with pointers?
- Next by thread: Re: why use -> (not .) with pointers?
- Index(es):
Relevant Pages
|