3 ms·
There's also iso646.h which allows you to do some particularly python looking stuff: #include <iso646.h> #include <stdbool.h> #include <stdio.h> #defin
by NegativeLatency 4y ago
There's also iso646.h which allows you to do some particularly python looking stuff:
#include <iso646.h>
#include <stdbool.h>
#include <stdio.h>
#define is ==
bool is_whitespace(int c) {
if (c is ' ' or c is '\n' or c is '\t') {
return true;
}
return false;
}
int main() {
int current, previous;
bool in_word;
while ((current = getchar()) not_eq EOF) {
if (is_whitespace(current) and not is_whitespace(previous)) {
putchar('\n');
} else {
putchar(current);
}
previous = current;
}
return 0;
}
- garaetjjte 4y agoOf course when you are willing to use preprocessor, you can do things like Bournegol: http://oldhome.schmorp.de/marc/bournegol.html http://oldhome.schmorp.de/marc/bournegol.html
- sargstuff 4y agoOr give C C++ functionality : https://libcello.org/ https://libcello.org/
- sargstuff 4y agoor throw exceptional loops : https://www.chiark.greenend.org.uk/%7Esgtatham/mp/ https://www.chiark.greenend.org.uk/%7Esgtatham/mp/
- sargstuff 4y agohttps://github.com/Hirrolot/metalang99 https://github.com/Hirrolot/metalang99
- gpderetta 4y agoIn C++ these are genuine operators and do not require the macros from iso646. I quite like them, but then again, I have been writing way too much python lately.