This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static const char *const SOURCE=(const char[]){ | |
#embed __FILE__ | |
,0}+72; | |
#include <stdio.h> | |
int main() { | |
puts(SOURCE); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
#; / / #; | |
#; / / #; | |
#; / / #; | |
#;/ / #; | |
#; / #; | |
#; / ; ; ; ; #; | |
#; / ####### #; | |
#;/ ## C ## #; | |
#; ;#####; #; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <errno.h> | |
#include <limits.h> | |
#include <stdbool.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define stringify_(x) #x | |
#define stringify(x) stringify_(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <errno.h> | |
#include <limits.h> | |
#include <stdbool.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define stringify_(x) #x | |
#define stringify(x) stringify_(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <pthread.h> | |
#include <string.h> | |
#include <stddef.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
static void *fn (void *p) | |
{ | |
pthread_detach(pthread_self()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# IMPORTANT: The HTTP authorization header must be found | |
# in ~/.openai in full, not just the API key. | |
# | |
# Usage: ./documentarist.sh /path/file.c "my_function()" | |
# | |
# Requirements: dos2unix, cpp, clang-format, jq, curl | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override BIN := test | |
override SRC := test.c msg.c | |
override OBJ := $(SRC:%=%.o) | |
override DEP := $(SRC:%=%.d) | |
CFLAGS := -O2 -march=native -mtune=native -flto | |
$(BIN): $(OBJ) | |
$(CC) $(CFLAGS) -o $@ $^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include <stdio.h> | |
/** Polish notation sizeof(). */ | |
#define of_size(x) __typeof__( \ | |
_Generic((x) \ | |
, int: of_signed (x) \ | |
, unsigned: of_unsigned (x)) ) | |
#define of_signed(x) \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define typeof_unqual(x) __typeof__(((void)1, *(__typeof__(x) *)(void *)0)) | |
int main(void) { | |
const int ci = 1; | |
typeof_unqual(ci) i1 = ci; | |
typeof_unqual(const int) i2 = ci; | |
i1 = 0; | |
i2 = 0; | |
return i1 + i2; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* If you compile with clang and `-Weverything' you'll probably want | |
* to use `-Wno-gnu-statement-expression-from-macro-expansion', too. | |
* | |
* Plain C18 version: | |
* https://gist.github.com/imaami/92b38f45142f8a8390fefa2d972bc63d | |
*/ | |
#define typeof_unqual(x) __typeof__(({ *(__typeof__(x) *)(void *)0; })) | |
int main(void) | |
{ |