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

Home » Public Forums » archive » Structure Containing Structure: question about parentheses
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Structure Containing Structure: question about parentheses [message #55253] Thu, 09 August 2007 08:36
larkn10 is currently offline  larkn10
Messages: 10
Registered: July 2006
Junior Member
Hi All,

I have a question about using parentheses with structures that are
members of a structure. I include a sample program below that
demonstrates the behaviors.

Basically I have no problem if I run the command

state.str.c = 50

But if I run the command

(state.str).c = 50

then I get the error:

Attempt to store into an expression: Structure reference.
Execution halted at: TESTSTRUCT 32 C:\teststruct.pro
$MAIN$


Can someone explain this behavior to me?

Thanks!

-Larry

___________________________________________________________
pro testStruct

;CREATE STRUCTURE str
str = {a:1,b:2,c:3,al:90,be:90,ga:90}

print,str.c
print,(str).c

str.c = 15
print,str.c
print,(str).c

(str).c = 25
print,str.c
print,(str).c

;CREATE STRUCTURE state WHICH INCLUDES str
state = {num:90,let:'e',str:str}

print,state.str.c
print,(state.str).c

str.c = 15
print,state.str.c
print,(state.str).c

help,state.str
help,(state.str)

;THE PROGRAM WILL FAIL AT THE NEXT LINE. WHY????
(state.str).c = 25
print,state.str.c
print,(state.str).c

end;testStruct
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Pass Pointer through procedures
Next Topic: indexing arrays with arrays

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

Current Time: Wed Oct 08 17:11:47 PDT 2025

Total time taken to generate the page: 0.00447 seconds