× 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.



Undefined behavior usually is!

Charles


On Fri, Dec 6, 2013 at 7:32 PM, Jon Paris <jon.paris@xxxxxxxxxxxxxx> wrote:

That is truly scary isn't it.


On 2013-12-06, at 7:19 PM, Barbara Morris <bmorris@xxxxxxxxxx> wrote:


RPG isn't consistent though. Both DSPLYs are done in this program, so
it's both false and true.

D fld s 10a inz('a')
C move fld *in10
C 10'cond t' dsply
C N10'ncond t' dsply
C return

Many languages specifically define that 0 is false and anything else is
true. But for RPG, it's undefined what will happen if an indicator
doesn't have the value '0' or '1'.

With RPG, since it's undefined behaviour, the compiler is free to
generate code to compare the indicator to either '0' or '1' depending on
which makes more sense for that specific case.



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.