Hidden features of C++
-
Here is another interesting site:
http://madebyevan.com/obscure-cpp-features/ -
i[str] = (i2-i)[str2];
I'm going to throw this in here, and doubtless wait for others to disagree: I think the compiler should generate a warning on
i[str]
. Do I realize it's the same asstr[i]
--- yes, I do. Do I realize it's just the same as*(i + str)
, which I wouldn't complain about --- yes, I do. Bit I'd still like to see a friendly, 2019, open source compiler warning abouti
not being indexable....EDIT "I think the compiler should": maybe I meant "I expected the compiler to"....
-
@fcarney said in Hidden features of C++:
digraphs
That's some bag-o-worms. My advice - don't dig there.
-
I think the take-away from this discussion is that if you want to write code to really piss off someone else who has to read or maintain it then use C++.
-
@Kent-Dorfman
No, C++ readability/maintenance has nothing on this little gem language, which has always been a favorite of mine: https://en.wikipedia.org/wiki/Brainfuck. Here, for example, is Hello World! in its entirety:++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
And you can go to https://sange.fi/esoteric/brainfuck/impl/interp/i.html to paste it in and run :)
-
@JonB there is also Malbolge, but i don't thik this languages are designed to write real programs.
hello world
('&%:9]!~}|z2Vxwv-,POqponl$Hjig%eB@@>}=<M:9wv6WsU2T|nm-,jcL(I&%$#" `CB]V?Tx<uVtT`Rpo3NlF.Jh++FdbCBA@?]!~|4XzyTT43Qsqq(Lnmkj"Fhg${z@>