[Cryptography] bounded pointers in C

Nemo nemo at self-evident.org
Tue Apr 22 21:32:30 EDT 2014


(DO NOT CORRECT PEOPLE ON THE INTERNET... I think I need to increase the
font size)

Dave Horsfall <dave at horsfall.org> writes:

> On Mon, 21 Apr 2014, Nemo wrote:
>
> By my recollection (going back to the PDP-11 days) is that an int has
> to be able to hold a pointer (a dreadful mistake, IMHO), and a long
> has to be at least the size of an int; oh, and a char had to be at
> least the size of a byte.

Only the last of those is guaranteed by the C specification. If you ever
see someone write "sizeof(char)", you can go ahead and fail their
interview because they don't know C (or C++).

>> "Learn your tools" is a good general principle, in my ever-humble
>> opinion.
>
> I'd like to see your counter-example.

First, I do not need a counter-example because I HAVE A SPEC. The
language is defined independently of any implementation; this is one of
the strongest arguments for using C at all, actually. If you code to the
spec, you can write routines that are guaranteed to run correctly both
on today's systems and tomorrow's.

But I realize there are lots and lots of bad programmers in the world
who will not find this argument convincing. So fine, here:

http://wiki.osdev.org/X86-64#64_bit_Environment_Models

"There are more things in heaven and earth" etc. That is why we CREATE
specs and DESIGN TO them and... oh never mind

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


More information about the cryptography mailing list