[Cryptography] bounded pointers in C

Nemo nemo at self-evident.org
Mon Apr 21 12:46:56 EDT 2014


Patrick Chkoreff <patrick at rayservers.net> writes:

> According to the C Language Reference Manual, it is guaranteed that a
> "long" (a.k.a "long int") is large enough to hold any pointer value.

This is getting increasingly off-topic, and I need to get back to
work... But this is simply not true.

> The standard explicitly says:
>
> ...
>
> (C Language Reference Manual, document 007-0701-150, Appendix A, Section
> F.3.7 "Arrays and Pointers")

"A" for effort, but that is not the C standard.

http://csweb.cs.wfu.edu/~torgerse/Kokua/More_SGI/007-0701-150/sgi_html/pr02.html

"This manual contains a summary of the syntax and semantics of the C
programming language as implemented on SGI workstations."

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

See section 6.3.2.3 paragraphs (5) and (6) and section 7.20.1.4.

> Assuming there are no other modes, I conclude that long ints are large
> enough to hold pointers, period.

As a general statement, your conclusion is incorrect.

"Learn your tools" is a good general principle, in my ever-humble
opinion.

 - Nemo
   https://self-evident.org/


More information about the cryptography mailing list