Re: Type define [message #14735] |
Thu, 25 March 1999 00:00 |
Phil Aldis
Messages: 11 Registered: February 1999
|
Junior Member |
|
|
In article <7dd6id$a4m@hermes.fundp.ac.be>,
"Tri VU KHAC" <tvk@info.fundp.ac.be> wrote:
> Hi,
>
> In C, we can define sth like
> #typedef A ....
> And in IDL, is this possible ?
>
> Thanks,
>
> Best regards,
> Tri.
>
>
I certainly can't think of a way to do it (although that doesn't nessecarily
mean you can't).
The fact that you're asking this question, suggests to me that you may be
declaring some of your variables in a C/C++ style when it's not nessecary.
Obviously sometimes you have to declare your variables beforehand, (eg if you
were reading data in from a file - IDL needs to know what type of variable it
should be reading, to name but one). But unlike C/C++, IDL is dynamically
typed which means that whereas in C/C++ you have to do:
int D;
float F;
D=65;F=79
.......... and a line like this D='A string' would cause errors. However in
IDL you can simply do this:
D=65
F=74.0
D='Hello'
.........and this is fine. IDL simply turns D into a string. So that means
that you dont't have to have at the top of your functions:
A=0.0
B=''
C=98
.
.
.
.
because most of the time your variables are defined by what is passed into
them. You can even call a function like this:
CurrentlyUndefinedVariable = N_Elements([1,2,3])
....and even though CurrentlyUndefinedVariable had never been mentioned anyway
before in your code, it is now a integer. This is one of the great features of
IDL because it you gives you such flexibiltiy.
If you knew all this already then just ignore my ramblings, but I hope it
helps.
Cheers,
Phil
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
|
|
|