diff options
author | Karl Williamson <khw@cpan.org> | 2018-09-19 15:31:34 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2018-09-20 08:30:45 -0600 |
commit | 86477e8975af27133f77fa918070748d5304ae49 (patch) | |
tree | c4967e8c9766c92ca69435565025a4af36308d96 | |
parent | 94b1fc235db3d15b93f78567e32ea87641156e25 (diff) | |
download | perl-86477e8975af27133f77fa918070748d5304ae49.tar.gz |
Create Ptrdiff_t type
which evaluates to SSize_t in the unlikely event that there isn't a
ptrdiff_t on the platform. ptrdiff_t is safer than ssize_t, as the
latter need not contain any negative number besides -1.
-rw-r--r-- | perl.h | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -1050,11 +1050,20 @@ EXTERN_C int usleep(unsigned int); # define STRUCT_OFFSET(s,m) offsetof(s,m) #endif -/* ptrdiff_t is C11, so undef it under pedantic builds */ +/* ptrdiff_t is C11, so undef it under pedantic builds. (Actually it is + * in C89, but apparently there are platforms where it doesn't exist. See + * thread beginning at http://nntp.perl.org/group/perl.perl5.porters/251541.) + * */ #ifdef PERL_GCC_PEDANTIC # undef HAS_PTRDIFF_T #endif +#ifdef HAS_PTRDIFF_T +# define Ptrdiff_t ptrdiff_t +#else +# define Ptrdiff_t SSize_t +#endif + #ifndef __SYMBIAN32__ # include <string.h> #endif |