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-29 15:02

>>37

typedef struct { int *numbers; } box;
typedef struct { const int *numbers; } box_consts;

Allocate a box, accept a box_consts. You can figure out the rest. You can also provide the struct anonymously in the function. If you don't want to cast, try using onion.

(Of course none of this is practical.)

>>38
When was the last time someone accepted your const data and then mangled data it referred to in an unexpected manner? I'm guessing never. People who write APIs like that don't acquire many users. People who write code like that don't collect many paycheques.

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