• Subject: Pointer arithmetic
  • From: David Morris <dmorris@xxxxxxxxxxxxx>
  • Date: Wed, 29 Apr 1998 11:47:04 -0600

Listees,

Does anyone know if the following should work?  Based on the manual I think it 
should work I faintly remember doing this in the past, but I can't get to work 
now.

D OffSet                        10I 0
D Ptr1                            *
D Ptr2                            *
...
C                   EVAL      OffSet = Ptr1 - Ptr2

I get the following message:

*RNF7421 30      1 Operands are not compatible with the type of operator.
                     Cause . . . . . :   Operands must be of class character or
                       graphic for character operations, numeric for arithmetic
                       operations, and indicator for logical and relational
                       operations. In a comparison operation, both operands must
                       have the same data type.  The specification is ignored.
                     Recovery  . . . :   Specify the correct operand classes and
                       data types. Compile again.

The manual states the following:

  Operator          Operand 1 Type     Operand 2 Type    Result Type      
  - (subtract       Basing Pointer     Basing Pointer    Numeric          
  pointers)                                                               

What am I missing here?  I have coded a work-around but I want to understand 
why this doesn't work.

Thanks,

David Morris
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                     
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This is the RPG/400 Discussion Mailing List!  To submit a new         *
* message, send your mail to "RPG400-L@midrange.com".  To unsubscribe   *
* from this list send email to MAJORDOMO@midrange.com and specify       *
* 'unsubscribe RPG400-L' in the body of your message.  Questions should *
* be directed to the list owner / operator: david@midrange.com          *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].