Signed word lengths and indexes

Kagamin spam at here.lot
Wed Jun 16 23:34:28 PDT 2010


Jérôme M. Berger Wrote:

> #include <assert.h>
> #include <stdio.h>
> 
> int main (int argc, char** argv) {
>    char*        data   = argv[0];  /* Just to get a valid pointer */
>    unsigned int offset = 3;
> 
>    printf ("Original: %p\n", data);
> 
>    data += offset;
>    printf ("+3      : %p\n", data);
> 
>    data += -offset;
>    printf ("-3      : %p\n", data);
> 
>    assert (data == argv[0]);    /* Works on 32-bit systems, fails on 64-bit */
> 
>    return 0;
> }
> 
Yo, dude!
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=97545


More information about the Digitalmars-d mailing list