× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: SV: C style assignment of variable values
  • From: Jim Langston <jlangston@xxxxxxxxxxxxxxxx>
  • Date: Thu, 07 Oct 1999 11:55:51 -0700
  • Organization: Conex Global Logistics Services, Inc.

A++ compiles to a faster CPU instruction to something like:
MOV AX,[A]
INC A
MOV [A],AX

Not sure if A += 1 would compile faster or not
A = B + 1 would compile to something like
MOV AX,[B]
MOV BX,1
ADD AX,BX
MOV AX,[A]

That was quite a while ago. though (80286) and not sure if they now allow
you to add directly to a memory location.  Perhaps (not sure) it would compile
to:
MOVE AX,1
ADD [A], AX

and be done with it.

I'm not up to par with the newest OP codes.  But I think they allow things like
that now.  I'm just not sure.  Any AS/400 Assembly language programmers here?
Or even Pentium Assembly language programmers.

Regards,

Jim Langston

Chris Bipes wrote:

> I also agree with KISS.  Yes too many choices and one can get lost.  I have
> been learning C lately and had a hard time with the A+=1.  Why not code
> A=A+1?  Does the compiler use a faster CPU instruction with the C syntax?
> Is it more efficient processing?  I like the pointers, procedures and other
> C type functions that have been added to RPG, but let not make RPG into C.
> Both languages have their place.  I agree that if you need the functions of
> C then buy a C compiler and program in C.  Or have someone write the C
> routines for you and give you a service program that you can bind to your
> RPG.
>

<SNIP>

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2024 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.