Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Should you dereference function pointers?

Name: Anonymous 2009-11-04 19:33

#include <stdio.h>

void func() {
  printf("hello world\n");
}

void (*go)() = func;

int main() {
  go();    // number 1...
  (*go)(); // or number 2
  return 0;
}


Which is correct ANSI C89? GCC accepts both, even in -ansi -pedantic; it outputs hello world twice.

Name: Anonymous 2009-11-06 4:09

>>22
Oh wow, I didn't realize deque<T> wasn't continuous until you mentioned. At work we wrote our own deque which is contiguous, and we use the &array[0] trick for memcpy and shit; I just assumed deque<T> worked the same way.

Anyway as a side note, the only other container in STL that is contiguous is basic_string<T>.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List