[Cryptography] GCC bug 30475 (was Re: bounded pointers in C)

Jonathan Thornburg jthorn at astro.indiana.edu
Fri Apr 25 13:21:34 EDT 2014


On Fri, Apr 25, 2014 at 08:31:42AM +0200, Stephan Neuhaus wrote:
> #include <stdint.h>
> 
> #if sizeof(ptrdiff_t) == 4
> #  define PTRDIFF_T_MAX INT32_MAX
> #elif sizeof(ptrdiff_t) == 8
> #  define PTRDIFF_T_MAX INT64_MAX
> #else
> #  error Your ptrdiff_t has a weird size
> #endif

The preprocessor doesn't grok  sizeof() , so this won't do what you want.
(One way to see the problem is you're writing  sizeof(type)  and C types
live within {}-scopes... but the preprocessor groks neither types nor
scopes.)

ciao,

-- 
-- "Jonathan Thornburg [remove -animal to reply]" <jthorn at astro.indiana-zebra.edu>
   Dept of Astronomy & IUCSS, Indiana University, Bloomington, Indiana, USA
   "There was of course no way of knowing whether you were being watched
    at any given moment.  How often, or on what system, the Thought Police
    plugged in on any individual wire was guesswork.  It was even conceivable
    that they watched everybody all the time."  -- George Orwell, "1984"


More information about the cryptography mailing list