diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2021-09-22 16:27:21 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2021-09-22 16:27:21 +0300 |
commit | 3b563cdcd4a34033aa855aeed579001c3913a1ae (patch) | |
tree | 549351188fc55c4239f9428d1dbd2f444fb3dcd3 /support | |
parent | b5a955b904d420dfd3e9216bf360858488f2bada (diff) | |
download | egawk-3b563cdcd4a34033aa855aeed579001c3913a1ae.tar.gz egawk-3b563cdcd4a34033aa855aeed579001c3913a1ae.tar.bz2 egawk-3b563cdcd4a34033aa855aeed579001c3913a1ae.zip |
Sync support files with GNULIB.
Diffstat (limited to 'support')
-rw-r--r-- | support/ChangeLog | 4 | ||||
-rw-r--r-- | support/idx.h | 20 | ||||
-rw-r--r-- | support/intprops.h | 1 |
3 files changed, 24 insertions, 1 deletions
diff --git a/support/ChangeLog b/support/ChangeLog index 1be9aeea..51ff18c9 100644 --- a/support/ChangeLog +++ b/support/ChangeLog @@ -1,3 +1,7 @@ +2021-09-22 Arnold D. Robbins <arnold@skeeve.com> + + * idx.h, intprops.h: Sync with GNULIB. + 2021-09-03 Arnold D. Robbins <arnold@skeeve.com> * dfa.h: Sync with GNULIB. diff --git a/support/idx.h b/support/idx.h index 483587ea..54ad5d81 100644 --- a/support/idx.h +++ b/support/idx.h @@ -56,6 +56,26 @@ * Because 'size_t' is an unsigned type, and a signed type is better. See above. + Why not use 'ssize_t'? + + * 'ptrdiff_t' is more portable; it is standardized by ISO C + whereas 'ssize_t' is standardized only by POSIX. + + * 'ssize_t' is not required to be as wide as 'size_t', and some + now-obsolete POSIX platforms had 'size_t' wider than 'ssize_t'. + + * Conversely, some now-obsolete platforms had 'ptrdiff_t' wider + than 'size_t', which can be a win and conforms to POSIX. + + Won't this cause a problem with objects larger than PTRDIFF_MAX? + + * Typical modern or large platforms do not allocate such objects, + so this is not much of a problem in practice; for example, you + can safely write 'idx_t len = strlen (s);'. To port to older + small platforms where allocations larger than PTRDIFF_MAX could + in theory be a problem, you can use Gnulib's ialloc module, or + functions like ximalloc in Gnulib's xalloc module. + Why not use 'ptrdiff_t' directly? * Maintainability: When reading and modifying code, it helps to know that diff --git a/support/intprops.h b/support/intprops.h index 9d10028a..3fe64e82 100644 --- a/support/intprops.h +++ b/support/intprops.h @@ -15,7 +15,6 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ -/* Written by Paul Eggert. */ #ifndef _GL_INTPROPS_H #define _GL_INTPROPS_H |