Re: order of clauses
От | Mitch Vincent |
---|---|
Тема | Re: order of clauses |
Дата | |
Msg-id | 00e901c0985d$1c90b540$0200000a@windows обсуждение исходный текст |
Ответ на | order of clauses (Patrick Welche <prlw1@newn.cam.ac.uk>) |
Список | pgsql-general |
Are you referring to short circuit? That's a language feature, isn't it? I didn't think it had anything to do with the compiler (I know C and a few other languages do it). Anyway, I could be wrong.. Seems that could break a lot of code if the programmer relies on short circuit in some conditional statements. if ( whatever() OR something() ) { blah(); } -- if "whatever" evaluates to true, then "something" isn't executed (the whole statement is true if one is true)... This really only comes into play when you're comparing the values returned by something (a method, function, etc), if you're just looking at boolean variable I guess it doesn't matter. -Mitch ----- Original Message ----- From: "Steve Wolfe" <steve@iboats.com> To: <pgsql-general@postgresql.org> Sent: Friday, February 16, 2001 3:10 PM Subject: Re: order of clauses > > > will give a divide by zero error as A=(y>0) and B=(x/y>1) can be > evaluated in > > > any order (A and B = B and A). I obviously would like (y>0) to happen > first, > > > but I don't see how this can be achieved.. Any ideas? > > I have one idea that would be nifty to implement. In some compilers, you > can turn off complete boolean checking. As soon as any part of an > expression will invalidate the expression, it stops evaluating all of it. > That can help you avoid division by zero, and keeps you from evaluating > parts of the expression that don't matter. It sounds like a good idea, at > least to an ignoramus like me. : ) > > steve > > >
В списке pgsql-general по дате отправления: