[Cryptography] bounded pointers in C

ianG iang at iang.org
Wed Apr 23 11:23:08 EDT 2014


On 23/04/2014 02:32 am, Nemo wrote:
> (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++).


Back in the day, I used to ask interviewees what the size of an int was.
 If they spouted a number, I knew they hadn't done much.  If they said
it was dependent on the machine size, I knew they had done enough C to
consider them.

The correct answer at the time was "no longer than a long and no shorter
than a short" although I forget the words from K&R.  Nobody ever got that.

Problem being, if you fail someone for not knowing the spec, you haven't
enough people to employ.

This is why we prefer interpreted, memory-safe OO languages over jedi
coders using heavy metal languages from the 1970s.  It's not idealistic,
it's pragmatic.



iang



More information about the cryptography mailing list