short-circuit logic in PL/I compiler, or lack thereof 
Author Message
 short-circuit logic in PL/I compiler, or lack thereof

Quote:

> if p ^= null then
>   if ...

> --

> I am not disagreeing with any of this; I do not personally write code this way
> (in PL1 anyway).  I have seen other PL1 code that is written this way and just
> wondered how big a problem it was.

Glad you don't.  The "other" code would cause problems.
Quote:
> OPC - Other People's Code.

> :)

> -Jay



Wed, 01 Jan 2003 03:00:00 GMT  
 short-circuit logic in PL/I compiler, or lack thereof

Quote:

> > I am not disagreeing with any of this; I do not personally write code
> this way
> > (in PL1 anyway).  I have seen other PL1 code that is written this way
> and just
> > wondered how big a problem it was.

> I would consider it a big problem.  Even if it currently works there is
> no guarantee that it will work in a future release of the compiler.

> The PL1 compiler we had on our VAX had additional operators &: and |:
> that would force everything before them to be evaluated first and then
> evaluate the everything after them only if needed.  It bugged me to no
> end when I ported code to NT to have change my code because of this.

A good case for sticking with the standard operaors,
and writing the nested-if version.
Quote:
> Randy



Wed, 01 Jan 2003 03:00:00 GMT  
 short-circuit logic in PL/I compiler, or lack thereof


Quote:

> > > I am not disagreeing with any of this; I do not personally write code
> > this way
> > > (in PL1 anyway).  I have seen other PL1 code that is written this way
> > and just
> > > wondered how big a problem it was.

> > I would consider it a big problem.  Even if it currently works there is
> > no guarantee that it will work in a future release of the compiler.

> > The PL1 compiler we had on our VAX had additional operators &: and |:
> > that would force everything before them to be evaluated first and then
> > evaluate the everything after them only if needed.  It bugged me to no
> > end when I ported code to NT to have change my code because of this.

> A good case for sticking with the standard operaors,
> and writing the nested-if version.

Which unfortunately won't help with the short-circuit OR case :(


Wed, 01 Jan 2003 03:00:00 GMT  
 short-circuit logic in PL/I compiler, or lack thereof

Quote:



> > > > I am not disagreeing with any of this; I do not personally write code
> > > this way
> > > > (in PL1 anyway).  I have seen other PL1 code that is written this way
> > > and just
> > > > wondered how big a problem it was.

> > > I would consider it a big problem.  Even if it currently works there is
> > > no guarantee that it will work in a future release of the compiler.

> > > The PL1 compiler we had on our VAX had additional operators &: and |:
> > > that would force everything before them to be evaluated first and then
> > > evaluate the everything after them only if needed.  It bugged me to no
> > > end when I ported code to NT to have change my code because of this.

> > A good case for sticking with the standard operators,
> > and writing the nested-if version.

> Which unfortunately won't help with the short-circuit OR case :(

There's a variation appropriate for the short-circuit OR case.


Thu, 02 Jan 2003 03:00:00 GMT  
 short-circuit logic in PL/I compiler, or lack thereof


Quote:
> > > A good case for sticking with the standard operators,
> > > and writing the nested-if version.

> > Which unfortunately won't help with the short-circuit OR case :(

> There's a variation appropriate for the short-circuit OR case.

Not without playing games with the basic structure of the if.  I've tried
to figure out what you meant here.  Tell me how to recode this in PL/I
without duplicating code:

        if (data_ptr == null || data_ptr -> ref_count == 0)
                return (e$xxx);

p.s. I'm not saying it's a big deal, just that lack of short-circuit can
be a PITA sometimes...



Thu, 02 Jan 2003 03:00:00 GMT  
 short-circuit logic in PL/I compiler, or lack thereof
IF DATA_PTR=NULL() THEN RETURN(E$XXX);
IF DATA_PTR->REF_COUNT=0 THEN RETURN(E$XXX);
Quote:



> > > > A good case for sticking with the standard operators,
> > > > and writing the nested-if version.

> > > Which unfortunately won't help with the short-circuit OR case :(

> > There's a variation appropriate for the short-circuit OR case.

> Not without playing games with the basic structure of the if.  I've tried
> to figure out what you meant here.  Tell me how to recode this in PL/I
> without duplicating code:

>         if (data_ptr == null || data_ptr -> ref_count == 0)
>                 return (e$xxx);

> p.s. I'm not saying it's a big deal, just that lack of short-circuit can
> be a PITA sometimes...



Thu, 02 Jan 2003 03:00:00 GMT  
 short-circuit logic in PL/I compiler, or lack thereof

says...

Quote:
> IF DATA_PTR=NULL() THEN RETURN(E$XXX);
> IF DATA_PTR->REF_COUNT=0 THEN RETURN(E$XXX);

Like I said...


Thu, 02 Jan 2003 03:00:00 GMT  
 short-circuit logic in PL/I compiler, or lack thereof

Quote:



> > > > A good case for sticking with the standard operators,
> > > > and writing the nested-if version.

> > > Which unfortunately won't help with the short-circuit OR case :(

> > There's a variation appropriate for the short-circuit OR case.

> Not without playing games with the basic structure of the if.  I've tried
> to figure out what you meant here.  Tell me how to recode this in PL/I
> without duplicating code:

>    if (data_ptr == null || data_ptr -> ref_count == 0)
>            return (e$xxx);

What does this mean?  null catenated with data_ptr?

- Show quoted text -

Quote:
> p.s. I'm not saying it's a big deal, just that lack of short-circuit can
> be a PITA sometimes...



Fri, 03 Jan 2003 03:00:00 GMT  
 short-circuit logic in PL/I compiler, or lack thereof


Quote:



> > > > > A good case for sticking with the standard operators,
> > > > > and writing the nested-if version.

> > > > Which unfortunately won't help with the short-circuit OR case :(

> > > There's a variation appropriate for the short-circuit OR case.

> > Not without playing games with the basic structure of the if.  I've tried
> > to figure out what you meant here.  Tell me how to recode this in PL/I
> > without duplicating code:

> >       if (data_ptr == null || data_ptr -> ref_count == 0)
> >               return (e$xxx);

> What does this mean?  null catenated with data_ptr?

No, sorry, this was C code.


Fri, 03 Jan 2003 03:00:00 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. short-circuit logic in PL1 compiler, or lack thereof

2. Which compiler does not short circuit by default?

3. Which compiler does not short circuit by default?

4. Number syntax, or lack thereof

5. Tree comprehension (or the lack thereof)

6. Fivewin support in OZ (or lack thereof)

7. DbC, lack of thereof, and the Linux kernel

8. Ethics (or lack thereof)

9. PYTHONDOCS, or lack thereof...

10. Tk performance (lack thereof)

11. Const correctness (and the lack thereof)

12. long = short*short ; (short,short) = long/short

 

 
Powered by phpBB® Forum Software