pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Doc: mention platform-dependent behavior of bitshift operators 7+ messages / 1 participants [nested] [flat]
* pgsql: Doc: mention platform-dependent behavior of bitshift operators @ 2026-10-01 02:16 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: David Rowley @ 2026-10-01 02:16 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/45277ca0d1cb6dbe722a01b3b5461c30abd40eee Modified Files -------------- doc/src/sgml/func/func-math.sgml | 7 +++++++ 1 file changed, 7 insertions(+) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Doc: mention platform-dependent behavior of bitshift operators @ 2026-10-01 02:17 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: David Rowley @ 2026-10-01 02:17 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/5229d4b3123a13c88b1e070bd7b5cfbabba4cf6d Modified Files -------------- doc/src/sgml/func/func-math.sgml | 7 +++++++ 1 file changed, 7 insertions(+) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Doc: mention platform-dependent behavior of bitshift operators @ 2026-10-01 02:17 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: David Rowley @ 2026-10-01 02:17 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/630e607397424196a0a3ebb14a5658c2473ddadf Modified Files -------------- doc/src/sgml/func.sgml | 7 +++++++ 1 file changed, 7 insertions(+) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Doc: mention platform-dependent behavior of bitshift operators @ 2026-10-01 02:17 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: David Rowley @ 2026-10-01 02:17 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/2250163c3964eec31eef74182f5bd772d4adb543 Modified Files -------------- doc/src/sgml/func.sgml | 7 +++++++ 1 file changed, 7 insertions(+) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Doc: mention platform-dependent behavior of bitshift operators @ 2026-10-01 02:18 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: David Rowley @ 2026-10-01 02:18 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/a13659ca66764f183e6704d2ccac2b3886ad383d Modified Files -------------- doc/src/sgml/func.sgml | 7 +++++++ 1 file changed, 7 insertions(+) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Doc: mention platform-dependent behavior of bitshift operators @ 2026-10-01 02:18 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: David Rowley @ 2026-10-01 02:18 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/d6896c056d69da2a451e032cd7b9823de299cdfb Modified Files -------------- doc/src/sgml/func.sgml | 7 +++++++ 1 file changed, 7 insertions(+) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Doc: mention platform-dependent behavior of bitshift operators @ 2026-10-01 02:18 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: David Rowley @ 2026-10-01 02:18 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/2028d62f3e79f2425d87d9f431c75d6f84bda06e Modified Files -------------- doc/src/sgml/func.sgml | 7 +++++++ 1 file changed, 7 insertions(+) ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2026-10-01 02:18 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-10-01 02:16 pgsql: Doc: mention platform-dependent behavior of bitshift operators David Rowley <drowley@postgresql.org> 2026-10-01 02:17 pgsql: Doc: mention platform-dependent behavior of bitshift operators David Rowley <drowley@postgresql.org> 2026-10-01 02:17 pgsql: Doc: mention platform-dependent behavior of bitshift operators David Rowley <drowley@postgresql.org> 2026-10-01 02:17 pgsql: Doc: mention platform-dependent behavior of bitshift operators David Rowley <drowley@postgresql.org> 2026-10-01 02:18 pgsql: Doc: mention platform-dependent behavior of bitshift operators David Rowley <drowley@postgresql.org> 2026-10-01 02:18 pgsql: Doc: mention platform-dependent behavior of bitshift operators David Rowley <drowley@postgresql.org> 2026-10-01 02:18 pgsql: Doc: mention platform-dependent behavior of bitshift operators David Rowley <drowley@postgresql.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox