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

Home » Public Forums » archive » Re: Way around zeroing of structures on creation?
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: Way around zeroing of structures on creation? [message #62183] Thu, 28 August 2008 13:20
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Christopher Thom writes:

> I have a simple routine that defines a structure I use a lot, so that the
> definition is automatic when I call it. e.g.
>
> pro mystrct__define
> tmp = {mystrct, $
> foo:0.0d, $
> bar:2.365434d
> }
> end
>
> The help pages about automatic structure definition are very explicit that
> all fields of a structure that is created by copying in this way will be
> zeroed (or strings converted to null strings).
>
> So...my question is, does anyone know a neat way around this? I want to
> fill my structure with useful constants that will not change, but i'd like
> to avoid having to do it by hand every time I create an instance of the
> structure.

Well, I guess you have thought of the obvious:

function mystrct
tmp = {mystrct, $
foo:0.0d, $
bar:2.365434d
}
return, tmp
end

IDL> thisStruct = Mystruct()

If you want it to be created the way YOU want it created,
why let IDL fool around with it?

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Previous Topic: Way around zeroing of structures on creation?
Next Topic: Can't access to RSI web-site

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

Current Time: Fri Oct 10 15:48:25 PDT 2025

Total time taken to generate the page: 1.83853 seconds