←back to thread

271 points mithcs | 1 comments | | HN request time: 0s | source
Show context
krapht ◴[] No.45953071[source]
C++: "look at what others must do to mimic a fraction of my power"

This is cute, but also I'm baffled as to why you would want to use macros to emulate c++. Nothing is stopping you from writing c-like c++ if that's what you like style wise.

replies(7): >>45953166 #>>45953176 #>>45953287 #>>45953573 #>>45954009 #>>45954016 #>>45961205 #
dboon ◴[] No.45954016[source]
No name mangling by default, far simpler toolchain, no dependence on libstdc++, compiles faster, usable with TCC/chibicc (i.e. much more amenable to custom tooling, be it at the level of a lexer, parser, or full compiler).

C’s simplicity can be frustrating, but it’s an extremely hackable language thanks to that simplicity. Once you opt in to C++, even nominally, you lose that.

replies(1): >>45958584 #
phs2501 ◴[] No.45958584[source]
I highly doubt (and some quick checks seem to verify that) any of the tiny CC implementations will support the cleanup extension that most of this post's magic hinges upon.

(Agree on your other points for what it's worth.)

replies(1): >>45962797 #
1. fuhsnn ◴[] No.45962797[source]
TinyCC supports cleanup[1], onramp[2] supports C2y defer (which is a superset), slimcc[3] supports both.

[1] https://godbolt.org/z/hvj9vcncG

[2] https://github.com/ludocode/onramp

[3] https://github.com/fuhsnn/slimcc