mirror of
https://github.com/postgres/postgres.git
synced 2026-10-23 13:29:09 +03:00
Doc: mention platform-dependent behavior of bitshift operators
There have been several recent complaints that << and >> don't behave the same way on all supported platforms. There is a risk that << overflows the signed integer type, which is undefined behavior, and there are platform-dependent behaviors from shifting by numbers of bits >= the bitwidth of the type, and also from shifting by negative values. Document this to warn unsuspecting users of these facts. Author: David Rowley <dgrowleyml@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CAApHDvr0O6ZF8NO=Rq9Q+Sz=FHT=NZ1kkNTXZDcNph-OWuk7TQ@mail.gmail.com Backpatch-through: 14
This commit is contained in:
@@ -863,6 +863,13 @@ SELECT NOT(ROW(table.*) IS NOT NULL) FROM TABLE; -- detect at least one null in
|
||||
are resolved by using the type appearing later in these lists.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The behavior of bitwise shifting, both left and right, has
|
||||
platform-dependent behavior both in cases of left shifting that results in
|
||||
a signed overflow and in cases of the results of shifting by more bits
|
||||
than exist in the type or from shifting by a negative value.
|
||||
</para>
|
||||
|
||||
<table id="functions-math-op-table">
|
||||
<title>Mathematical Operators</title>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user