Thanks for the replies. I noticed a while back that when I compiled using the 
64 bit compiler (I’m using c++ builder 10.1 which I think is clang) it gave 
warnings when || and && were mixed but not bracketed. Was worried I had missed 
something.

From: Simon Slavin<mailto:slav...@bigfraud.org>
Sent: 25 June 2017 20:14
To: SQLite mailing list<mailto:sqlite-users@mailinglists.sqlite.org>
Subject: Re: [sqlite] operator precedence



On 25 Jun 2017, at 7:59pm, J Decker <d3c...@gmail.com> wrote:

> SQL Standard
> http://web.cecs.pdx.edu/~len/sql1999.pdf
> doesn't seem to have math operators... and the precedence tables are
> described in longhand without a simple table....
> DateTimes have math operators
>
> "Operations on numbers are performed according to the normal rules of
> arithmetic, within implementation-defined limits, except as provided for in
> Subclause 6.26, ‘‘’’."

Which comes from SQL-92 which comes from SQL-89, almost unchanged.  However, & 
and | were not considered numeric operators at that point, so they didn’t 
figure into statements about the precedence of numeric operators.

BIDMAS (excuse me, I’m British) does apply, and it’s implemented in SQLite.  Of 
course, bitwise operators don’t feature in it because BIDMAS is for numbers and 
not bitwise operators.

My personal answer to the original question is "history".  C wasn’t the huge 
juggernaut back in 1989 that it is now.  A programmer could work their whole 
life without seeing a line of C code.  So there was no instinct to build C 
rules into everything else.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to