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

-std=c99 my anus

Name: Anonymous 2009-11-25 15:29

[code]$cat test.c
#include <stdlib.h>
#include <string.h>

int main(void) {
    char *foo;
    foo = strdup("bar");
    free(foo);
    return 0;
}
$gcc test.c
$gcc -std=c99 test.c
test.c: In function 'main':
test.c:6: warning: implicit declaration of function 'strdup'
test.c:6: warning: assignment makes pointer from integer without a cast[code]
What the heck is this, /prog/? Is there some shit around strdup() in c99?

Name: Anonymous 2009-11-26 21:23

>>22
of course they are still incompatible types because I can specialize on the const qualifier. observe
God damnit, another one explaining to me the rules of const, as though I don't understand them. Specializing a template on const would not be necessary if the const was propagated. If the implicit cast was allowed, then upon implicitly converting a something<T> to something<const T>, the compiler could automatically instantiate the const template, and the template functions that don't respect the const simply wouldn't be compiled into the copy (SFINAE).

>>23
You'd rather we just work with what we have and never try to improve anything? No need to invent a screwdriver folks, we already have hammers.

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