Search:

Type: Posts; User: Elysia

Search: Search took 0.16 seconds.

  1. Replies
    13
    Views
    3,524

    It would be possible at runtime, yes. Perhaps you...

    It would be possible at runtime, yes. Perhaps you can use...
    if (sizeof(a) != sizeof(b)) abort();
    ...type of macro.
    It's runtime, but it's better than nothing.
    (C++ can do it compile time.)
  2. Replies
    13
    Views
    3,524

    Indeed. It's potent stuff.

    Indeed. It's potent stuff.
  3. Replies
    13
    Views
    3,524

    Psuedo code, but... Something along the lines...

    Psuedo code, but...
    Something along the lines of:

    int main()
    {
    char mychar;
    int myint;
    char* c = safe_cast<char>(mychar); // Compiles
    c = safe_cast<char>(myint); // Won't...
  4. Replies
    13
    Views
    3,524

    I don't think this sort of thing can be done in...

    I don't think this sort of thing can be done in C, or at least not easily.
    However, it can be done easily in C++.
Results 1 to 4 of 4