Python is just as good as C++ for real apps
Grant Edwards
grante at visi.com
Sat Jan 26 12:16:12 EST 2002
In article <q1k55ukf60ebj72s0vdghrpsia3r11dfjc at 4ax.com>, Courageous wrote:
>
>>I never said anything about p. I've always been talking about
>>*p.
>
> Well I've always been talking about p, because "*p" isn't an atomic
> thing, it's the identifier "p" with the operator "*". I could with
> a lot of work show you an abstract syntax tree that proves it, too. :)
I know.
All I was trying to do was to explain a way to think about
declarations to make it more intuitive why
int* p,i,j,k;
doesn't do what people sometimes think it ought. If you are
thinking to yourself that "int*" declares a pointer to an int,
then
int* a,b,c,d;
obviously must declared 4 pointers to ints. But it doesn't.
Therefore, thinking of "int*" as a type isn't always very
productive.
If, rather you think to yourself that "int" delcares an
integer, and we want "*p" and "i" to be integers, then we do
something like:
int *p,i;
or
int i,*p;
If you think like that, then it's obvious that if you want four
pointers you have to do it like this:
int *a,*b,*c,*d;
--
Grant Edwards grante Yow! Edwin Meese made me
at wear CORDOVANS!!
visi.com
More information about the Python-list
mailing list