4 ms·
You can use POSIX functions in -std=c17 or similar. For instance: #define _POSIX_C_SOURCE 200809L #include <stdio.h> #include <stdlib.h> #inclu
by JoshTriplett 4y ago
You can use POSIX functions in -std=c17 or similar. For instance:
#define _POSIX_C_SOURCE 200809L
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
char *x = strdup("hello world");
printf("%s\n", x);
free(x);
return 0;
}
- account42 4y agoExactly, these are libray extensions so they are controlled via defines and not (directly) via compiler flags. Which ones there are (and what they do) depend on the standard C library and not the compiler. For glibc: https://ftp.gnu.org/old-gnu/Manuals/glibc-2.2.3/html_node/libc_13.html https://ftp.gnu.org/old-gnu/Manuals/glibc-2.2.3/html_node/li...