6 ms·
trigraphs are removed in c++ 17 https://en.m.wikipedia.org/wiki/C%2B%2B17#Removed_features https://en.m.wikipedia.org/wiki/C%2B%2B17#Removed_features
by kenniskrag 4y ago
trigraphs are removed in c++ 17
https://en.m.wikipedia.org/wiki/C%2B%2B17#Removed_features https://en.m.wikipedia.org/wiki/C%2B%2B17#Removed_features
- amelius 4y agoI've never seen them used anywhere.
- Rebelgecko 4y agoThey're good for obfuscating source code but AFAICT that's about it on modern machines
- sargstuff 4y agoLess obscure if physical print type head doesn't have the corresponding trigraph representation. Unicode is a worthy successor to trigraphs -- no need for pre-processing! Guess with tri-graph elimination & awk getting unicode support will have to gawk C with cpp using pipology theory. But think the cpp has to go away first, after enough sed. https://grayson.sh/blogs/using-piphilology-to-hide-strings https://grayson.sh/blogs/using-piphilology-to-hide-strings https://www.gnu.org/software/gawk/manual/gawk.html#Signature-Program https://www.gnu.org/software/gawk/manual/gawk.html#Signature...
- mfost 4y agoThey were meant for coding C on machines that had even less than ASCII as available text encoding really. So no wonder you never see them.
- shakna 4y agoThey were meant, mostly, for punch-card machines. So if you started programming anywhere after the point in time when you needed to hand off your code to a punch card operator, you're unlikely to have seen them.
- WalterBright 4y agoThey were meant to support EBCDIC.
- pjmlp 4y agoThey are still around in C though.
- david2ndaccount 4y agoThey are being removed in C23.
- pjmlp 4y agoI see, thanks.
- KerrAvon 4y agogone in C23
- piesquaredarr 4y agoHuh, I never realized that C++ standards were removing C features. Time to be more careful about using g++ for everything.
- Denvercoder9 4y agoC++ has never been a strict superset of C. The most obvious example is the "class" and "new" keywords which can be used as an identifier in C, but not in C++. There's more subtle differences as well, such as character literals having type int in C and char in C++.
- wheels 4y agoAnother really common one is that casting from void * to any other type doesn't require a cast in C, but it does in C++: #include <stdlib.h> int main() { int *foo = malloc(sizeof(int)); return 0; } That works in C, but not in C++. There's actually another subtle different in there that main() means "unspecified arguments" in C, and "no arguments" in C++. ("No arguments" in C would be main(void).) However, it's no longer commonly used that way in C, but casts from void * to other types is very common in C.
- favorited 4y agoThe `func()` vs `func(void)` difference has been deprecated for a while, and is removed in C23.
- bee_rider 4y agoAh, what an elegant example, haha.
- tialaramex 4y agoUsing unions for type punning is legal C, but the exact same code has UB in C++ The modern C++ way to do this ~safely isn't legal C, and yet the type pun isn't safe in C++. I believe using memcpy() to launder the bits is legal in both languages and in some cases your compiler can figure out what you're doing and not actually emit the unnecessary copy.