comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » compile a routine wich inlude a commun
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: compile a routine wich inlude a commun [message #47125 is a reply to message #47067] Tue, 24 January 2006 08:01 Go to previous messageGo to previous message
peter.albert@gmx.de is currently offline  peter.albert@gmx.de
Messages: 108
Registered: July 2005
Senior Member
> No, it does not. Whether or not you point to the "complete" variable, or just a part of
> it, a new heap "variable" is created.
>
> IDL> x=indgen(4,4)
> IDL> print, x
> 0 1 2 3
> 4 5 6 7
> 8 9 10 11
> 12 13 14 15
> IDL> p=ptr_new(x)
> IDL> print, *p
> 0 1 2 3
> 4 5 6 7
> 8 9 10 11
> 12 13 14 15
> IDL> print, (*p)[1:2,1:2]
> 5 6
> 9 10
> IDL> (*p)[1:2,1:2] = (*p)[1:2,1:2] + 100
> IDL> print, *p
> 0 1 2 3
> 4 105 106 7
> 8 109 110 11
> 12 13 14 15
> IDL> print, x
> 0 1 2 3
> 4 5 6 7
> 8 9 10 11
> 12 13 14 15

Damn, I should have tried it before. I was so sure :-(

But then, this _is_ a polite group. Nobody murmuring something like
rtfm, while a look in the manual reveals :

"If InitExpr is provided, PTR_NEW uses it to initialize the newly
created heap variable. Note that the new heap variable does not point
at the InitExpr variable in any sense-the new heap variable simply
contains a copy of its value."

Well, here is is, black on white. So you _can't_ alias variables or
subarrays.

Cheers,

Peter
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Picture of Prairie
Next Topic: MODE in IDL?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 20:47:21 PDT 2025

Total time taken to generate the page: 0.00597 seconds