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

Home » Public Forums » archive » -32768
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: -32768 [message #88106 is a reply to message #88104] Thu, 20 March 2014 14:11 Go to previous messageGo to previous message
Jim  Pendleton is currently offline  Jim Pendleton
Messages: 165
Registered: November 2011
Senior Member
On Thursday, March 20, 2014 11:01:01 AM UTC-6, Karl wrote:
> On Thursday, March 20, 2014 3:24:59 AM UTC-6, Rob Klooster wrote:
>
>> The reason it does not work, is that you first try to define +32768 and then negate the result. Since +32768 can only be expressed as a long, you end up with a long variable. Using fix is a solution, but you could also use the bitwise not operator, if you feel adventurous:
>
>>
>
>> IDL> a = not 32767
>
>>
>
>> IDL> help, a
>
>>
>
>> A INT = -32768
>
>
>
> And whether this is a "bug" in IDL or not depends on how IDL defines literal constants.
>
>
>
> If an IDL (integral) constant has the form (excuse my abuse of regex):
>
>
>
> [+-][0-9]*
>
>
>
> then one could argue this is be a bug.
>
>
>
> If a constant can be only:
>
>
>
> [0-9]*
>
>
>
> then, the '-' is taken as an operator and this would not be considered an IDL bug.
>
>
>
> C allows:
>
>
>
> short a = -32768;
>
>
>
> but warns about:
>
>
>
> short a = -32769;
>
>
>
> on a machine where a short is 16 bits.

The docs on numeric constants imply that the "+" and "-" are considered operators.

http://www.exelisvis.com/docs/Defining_and_Using_Const.html

This can also be tested experimentally by writing a DLM that checks if an input IDL_VARIABLE is an expression or a constant.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Killing Widget Objects
Next Topic: How to choose the pixels along a curve in an image

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

Current Time: Wed Oct 08 13:55:25 PDT 2025

Total time taken to generate the page: 0.00562 seconds