Tuesday, July 28, 2009

Trapped in a C++ world

reinterpret_cast<Spidey01 *>(working); // does anyone get the joke?

1 comment:

  1. Originally posted on my Live Journal:

    Subject: Explained
    By: sas_spidey01 at 2009-07-29 09:58 pm (UTC)
    Comment: For all the friends who didn't get it:

    Trapped in, as in spending A LOT of time
    a C++ world, the language I'm using lately (oi)
    Spidey01 *, a pointer to me
    working, probably an integer value (e.g. number of hours) or unrelated pointer
    reinterpret_case; convert working's type to a pointer a Spidey01

    From the C++ Reference: 'reinterpret_cast is used to perform conversions between unrelated types, like conversion between unrelated pointers and references or conversion between an integer and a pointer.' (source)

    for an extra laugh, consider this C and C++ code:

    printf("Hi %s", (char*)6);



    which should result in a program crash or something equally nasty.

    ReplyDelete