E. Robert Tisdale wrote:[color=blue]
>
> rs wrote:
>[/color]
[ snip ][color=blue][color=green]
> > 2) Is there any history behind the use of the "*" operator
> > in providing dereferencing capabilities or is it arbitrary?[/color]
>
> It is arbitrary but I'm sure that K&R carefully considered the choices.
>[/color]
K&R didn't write C. R did.
[color=blue][color=green]
> > I'm specifically interested in why K&R didn't just introduce
> > a set of keywords for memory referencing/dereferencing.[/color]
>
> Like the sizeof operator?
> I think that their objective was simply to be concise.
> Teletype was still popular when K&R were designing C.[/color]
Again, Dennis Ritchie designed C. Brian Kernighan was the author of the
book, not the co-designer of the language.
[color=blue]
> They were probably just trying to minimize the number of keystrokes
> that programmers would be obliged to type so they exploited
> the punctuation available on an ASCII keyboard.
>[color=green]
> > 3) [OT - But I would appreciate an answer if you have one]
> > C++ has the reference operator which, in my limited experience,
> > is just a convenient way of doing pointers; Is this so?
> > Is there any major difference in the semantics or am I right?[/color]
>
> A pointer is an object which contains the address of another object.[/color]
Yes.
[color=blue]
> A reference is just another name for an object.[/color]
Absolutely not!
[color=blue]
> In the C computer programming language,
>
> const char* p = "qwerty";
>
> p is a *pointer* to a character with [constant] value 'q' and
> *p is a *reference* to that character.
>[/color]
No. C has no 'reference' at all except as you may use the English word
as 'refers to' or somesuch. In C++ and other languages, 'pass by
reference' infers semantics and operations that simply can't be done in
C.
[color=blue][color=green]
> > 4)Is there any practical use
> > for pointers of more than 2 levels of indirection?[/color]
>
> Rarely.
>[color=green]
> > If this is the case,
> > would anything have been gained (I guess apart from
> > slight grammar simplification and compiler implementation simplicity)
> > from introducing T** and leaving it at that?[/color]
>
> No.
> Limiting the levels of indirection would probably just make the grammar
> less comprehensible and the compiler more complicated.[/color]
--
Joe Wright
http://www.jw-wright.com
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---