Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!sun-barr!texsun!pollux!ti-csl!m2!neath From: neath@solar-1.stars.flab.Fujitsu.JUNET Newsgroups: comp.lang.c++ Subject: Reference to Pointer Message-ID: Date: 12 Jun 89 08:08:32 GMT Sender: news@ti-csl.csc.ti.com Distribution: comp.lang.c++ Organization: Texas Instruments Data Systems Group, Austin TX Lines: 27 I am trying to understand the workings of pointer vs. reference. Specifically, the following piece of code declares a typedef for char*, then proceeds to use a reference to this typedef as a function argument type. This works fine and is accepted by <>: #include typedef char* charP; void bar (const charP& c) { cout << form ("%s\n", c); } void foo (void) { bar ("HELLO WORLD"); } Now, what does it really mean to have a reference to a pointer to a thing in memory? Do I really get two levels of indirection here? If this is allowed by cfront, why can't I use a "char*&" instead of having to declare the typedef of charP? At the least, whatever the rule, it should be consistently followed. Regards Martin Neath ------------------------------------------------------------------------ DISCLAIMER: As always, the opinions expressed above are strictly my own and do not reflect those of my employer, Texas Instruments. ------------------------------------------------------------------------