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

An enigma

Name: Anonymous 2009-06-09 18:35

So, /prog/, a C question: I have int somevariable [10][10]; How do I declare a pointer to the first row of this array?

Name: Anonymous 2009-06-12 12:12

>>37

short* f() {
    printf("side effect\n");
    return 0;
}

int main(void)
{
    char * s = "";
    printf("%zu\n", ARRAY_LENGTH(s));
    printf("%zu\n", ARRAY_LENGTH(&s));
   
    printf("%zu\n", ARRAY_LENGTH(f)); // WTF is this shit?
    printf("%zu\n", ARRAY_LENGTH(*f)); // WTF?
    printf("%zu\n", ARRAY_LENGTH(**f)); // WTF??
    printf("%zu\n", ARRAY_LENGTH(***f)); // WTF???
    printf("%zu\n", ARRAY_LENGTH(&f)); // WTF?
    // printf("%zu\n", ARRAY_LENGTH(&&f)); // WTF is 'label f not defined'?
    printf("%zu\n", ARRAY_LENGTH(f())); // where is my side effect?
    // printf("%zu\n", ARRAY_LENGTH(&f())); // WTF, why can't I do this then?
    int * x = 0;
    printf("%zu\n", ARRAY_LENGTH(x++)); // Can you guess what happens?

    return 0;
}

None of the above should compile. None of the above compiles in C++. If we are trying to help those who are "retarded enough not to remember the cardinality of the array", as >>21 aptly put it, the usual arguments about manliness and having enough rope are even more irrelevant than usual.

Therefore I must conclude that your statement,
also, c does it better
Is grossly inaccurate.

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