simh help?

From: Sean 'Captain Napalm' Conner <spc_at_conman.org>
Date: Thu May 29 14:42:01 2003

It was thus said that the Great Patrick Finnegan once stated:
>
> On Thu, 29 May 2003, Brian Hechinger wrote:
>
> > IMHO that's *always* a good thing. it has really opened my eyes to the fact
> > that your average opensource coder has been so coddled by the whole gcc/x86
> > platform that they have really started to make stupid mistakes and even
> > stupider assumptions about things. the most common assumption is that a
> > void pointer and an int pointer is the same size. which just happens to be
>
> Do you mean void * and int (not a pointer)? All pointers should be the
> same size... (Sorry, I'm being pedantic.)

  No, they don't have to be the same size; I think I recall that char * on
certain PDPs were slightly larger than say, an int * (because pointers only
pointed to word boundaries, yet you could pack several characters per word
so extra storage was needed to store the offset into a word for a char *).
And don't forget the whole mess with near and far pointers in the DOS world
(technically those were extentions but ... ).

  Given the following declaration:

        void *vp1;
        void *vp2;
        char *cp1;
        char *cp2;
        int *ip;

  The following should hold true:

        vp1 = cp1;
        cp2 = vp1;
        assert(cp1 == cp2); /* should be fine */

  While the following may or may not work:

        vp1 = cp1;
        ip = vp1;
        vp2 = ip;
        cp2 = vp2;
        assert(cp1 == cp2) /* may or may not hold */

  -spc (Don't have the C Standard handy ... )
Received on Thu May 29 2003 - 14:42:01 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:36:16 BST