[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: David: for your book ?



Craig Markwardt wrote:
> 
> Martin Schultz <martin.schultz@dkrz.de> writes:
> > As an aside, I recently found another problem in terms of backward
> > compability (I am
> > sure something similar was already mentioned in this newsgroup, but this
> > was the first
> > time I had this problem):
> >    I tried to write a routine that takes advantage of the new StrMatch
> > and StRegex
> > functions in 5.3. In order to ensure backward compatibility, I enclosed
> > these function calls
> > with
> >     IF !Version.Release GE 5.3 THEN BEGIN
> >     ENDIF
> >
> > However, a colleague tells me: no chance! The program will report a
> > syntax error when run in
> > IDL 5.2! So, the problem is that IDL looks for a function of this name
> > during compile stage
> > and doesn't care if it will ever be used.
> ...
> 
> There is a way to do this without defining an external function, by
> using FORWARD_FUNCTION properly:
> 
> FORWARD_FUNCTION stregex, strmatch
> IF !Version.Release GE 5.3 THEN BEGIN
>    foo = stregex(bar)
>    sm = strmatch(eg)
> ENDIF
> 
> This will make sure that IDL will always recognize strmatch & stregex
> as functions during the compilation stage, and there will be no syntax
> errors in any IDL version.  It is harmless in IDL 5.3.  If you really
> want the warning message, then by all means go ahead and make your own
> strmatch definitions et al.
> 
> Have fun,
> Craig

Thanks, Craig.

I didn't believe that this would cure it (I had thought it would just
change the 
error message), but you are right, it works. So, maybe some people can
still live 
with IDL 5.2 after all.

BTW: any one out there who is still using earlier versions (prior to
5.2)?
Maybe I shouldn't ask because I fear this will swamp the newsgroup -- so
please
reply only by email, subject "old idl", content '!version = ' then I
will 
collect these messages for a while and report a summary later (after a
week 
or two). I assure you that these messages will be kept strictly
confidental and
will be deleted after processing the version information.

Cheers,
Martin




-- 
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
[[ Dr. Martin Schultz   Max-Planck-Institut fuer Meteorologie    [[
[[                      Bundesstr. 55, 20146 Hamburg             [[
[[                      phone: +49 40 41173-308                  [[
[[                      fax:   +49 40 41173-298                  [[
[[ martin.schultz@dkrz.de                                        [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[