Re: Strange IDL string bug [message #4818] |
Wed, 09 August 1995 00:00 |
offenbrg
Messages: 31 Registered: August 1993
|
Member |
|
|
Justin Baker <justinb@bom.gov.au> writes:
> I have discovered an unusual bug with IDL strings (IDL V4.0) and was wondering
> if anyone else has seen it.
> I quickly discovered that there seems to be a problem with " quoted strings if
> they start with a digit.
> IDL> ok_string='12345'
> IDL> bad_sting="678910" ^
> % Syntax error.
> Can anyone shed any light on this problem ?
Somewhere along the way, RSI decided to make "xxx (where xxx are digits)
stand for "This number is Octal (base 8)" as opposed to "this number is a
string."
IDL> print, '123
123
IDL> print, "123
83
123 in *octal* = 83 in *decimal*.
One nasty side effect of this, of course, is that "123" is not a string,
but an octal number with a stray " mark at the end. Also, "12ab" isn't a
string, either, but an octal number with ab" stuck at the end.
This problem pre-dates IDL 4.0, by the way.
Joel
--
"...And I am unanimous in this" - Mrs. Slocumbe
------------------------------------------------------------ ----------
| Joel D Offenberg | offenbrg@fondue.gsfc.nasa.gov |
| Hughes STX, NASA/GSFC/LASP | I get paid to stare into space. |
|
|
|
Re: Strange IDL string bug [message #4820 is a reply to message #4818] |
Wed, 09 August 1995 00:00  |
Rolf P. W\"urtz
Messages: 3 Registered: June 1995
|
Junior Member |
|
|
Justin Baker <justinb@bom.gov.au> wrote:
>
> I quickly discovered that there seems to be a problem with " quoted strings if
> they start with a digit.
>
The error is due to the fact that "123 means the _octal_ value of 123. How
somebody could get this idea is beyond me. Even stranger than a leading zero,
IMHO. To make it even more interesting, IDL does not check for unbalanced
quotes, so the following works:
%print, '123
123
%print, "123
83
Lovely, isn't it?
Rolf
+----------------------------------------------------------- ----------------+
| Rolf P. W"urtz | mailto:rolf@cs.rug.nl | URL: http://www.cs.rug.nl/~rolf/ |
| Department of Computing Science, University of Groningen, The Netherlands |
+----------------------------------------------------------- ----------------+
|
|
|