Re: Thou shalt have no other gods before the ANSI C standard

From: Hank Oredson (horedson_at_earthlink.net)
Date: 02/12/05


Date: Sat, 12 Feb 2005 01:54:29 GMT


"Beth" <sneezie@unlisted.net> wrote in message
news:110220051317263545%sneezie@unlisted.net...
> In article <1220.902T2081T13265678@kltpzyxm.invalid>, Charlie Gibbs
> <cgibbs@kltpzyxm.invalid> wrote:
>
>> In article <slrnd0o72o.1opp.usenet@stoneport.math.uic.edu>, djb@cr.yp.to
>> (D. J. Bernstein) writes:
>
>> > By the end of the course, 16 students had submitted 91 reports of
>> > security problems, mostly buffer overflows. I'm sure that the students
>> > wouldn't have been able to do this if I had spent the semester saying
>> > ``A byte might be 9 bits!''
>
>> "I'm keeping my index in a byte, so I might as well hard-code my
>> table size at 256 entries."
>
> The right way to handle this, of course, is to encapsulate the
> allocation of the table and to use a symbolic range, such as {0...255}
> or {1...256}, if you want to be persnickety, or {3...373}, if that's
> the range that's needed, and let the compiler worry about optimizing
> the range to the machine architecture.
>
>> > and ``Integers might be ones-complement!''
>
>> "I know the bit pattern for -1. Why should I waste time using a
>> predefined symbolic value?"
>
> I'm pretty sure you contradicted yourself here. As programmer I
> shouldn't need to care what the machine representation is, which is Dr.
> Bernstein's point, I think. I'm interested only in the symbolic value
> that is appropriate to my application.

Of course there is that little problem of writing, e.g., that memory
mapped I/O device driver. Oh! It takes 32 bits at once! I wonder
how the device maps what IT thinks to this Plexus machine it
is plugged into. What in heck did I do wrong by just writing my
32 bit saved register value to that device anyway?

-- 
  ... Hank
http://home.earthlink.net/~horedson
http://home.earthlink.net/~w0rli 


Relevant Pages

  • Re: [PATCH 00/28] Swap over NFS -v16
    ... I'm so glad you are working with me on this and writing this in human ... there is the swap cache. ... allocation and freeing, and that wouldn't work well with slub. ... write-intent bitmaps for md/raid arrays. ...
    (Linux-Kernel)
  • Re: Another newbie question
    ... entities which make up a coordinate -- the x and y ordinates. ... I could encapsulate the lot with a factory function that applied ... I'm not writing a general anything-coordinate class, ... because those float methods are two levels away. ...
    (comp.lang.python)
  • Re: Current tools for finding memory overwrites
    ... Fair enough, the whole problem with memory corruptions is that you can only detect a corruption in the area around a memory allocation, not the allocation itself (because it may be a valid write - the only people that can detect a corruption of data in an object are the people that wrote the object, by writing a function for integrity testing and calling it at regular intervals). ... Plus if you know where the data is getting knobbled, the analysis tab coupled with the Allocation History settings can be useful for finding references to your object that also reference parts of previously deleted objects. ...
    (microsoft.public.win32.programmer.tools)
  • MY SCAN DISK WONT WORK
    ... >My scan disk won't work. ... ten tries and another drive was writing to the File ... Allocation Table. ... Good Luck ...
    (microsoft.public.windowsupdate)
  • Re: Uploading large files from an iPAQ
    ... do you know whether it's a good idea to flush the stream ... as I'm writing the HTTP request? ... > actual allocation call. ...
    (microsoft.public.dotnet.languages.csharp)