[Cryptography] bounded pointers in C
Patrick Chkoreff
patrick at rayservers.net
Mon Apr 21 14:52:02 EDT 2014
Nemo wrote, On 04/21/2014 12:46 PM:
> So you are not reading the standard. You are reading the manual for a
> particular C compiler on a particular system that no longer exists.
>
> The C standard looks more like this:
>
> http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
Excellent, good point, thank you.
> See section 6.3.2.3 paragraphs (5) and (6) and section 7.20.1.4.
Yes, and I see that intptr_t is optional, so the only really portable
way to do what I'm talking about is to bite the bullet and use a union,
e.g.:
union
{
unsigned long N;
void *P;
};
I'm also replacing overflow checks with truly portable versions, along
the lines of:
unsigned int x = ...;
unsigned int y = ...;
assert(x <= UINT_MAX - y);
unsigned int z = x + y;
Fortunately all references to such details are confined to a *very* few
points in my code.
-- Patrick
More information about the cryptography
mailing list