_______ __ _______
| | |.---.-..----.| |--..-----..----. | | |.-----..--.--.--..-----.
| || _ || __|| < | -__|| _| | || -__|| | | ||__ --|
|___|___||___._||____||__|__||_____||__| |__|____||_____||________||_____|
on Gopher (inofficial)
URI Visit Hacker News on the Web
COMMENT PAGE FOR:
URI C++26: The Oxford Variadic Comma
rusakov-field wrote 38 min ago:
Clarity and Elegance of Syntax > Backwards compatibility.
In my opinion anyway. C++ feels so bloated these days.
blueaquilae wrote 1 hour 0 min ago:
I'm far from C++ but reading this article confused be, from the form to
the impact to the dead link [1] I guess that's a preview how C++
require a lifelong commitment.
URI [1]: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1219...
HackerThemAll wrote 1 hour 52 min ago:
Yes, but no. I learned C++ in '90s when it was C with classes and some
other noise added by Stroustrup. During the some 25 years that followed
it had became a mess that's insanely hard to work with. I'm not going
back to this language. I prefer plain C or Rust, leaning towards Rust
when I fully comprehend the lifetime and borrow checker. Or when I have
the luxury of having a GCed runtime, then the .NET with its easiest C#
language with wonderful abundance of great libraries is the best
choice. Nobody was ever fired for using .NET (for right purposes).
zlfn wrote 2 hours 13 min ago:
C++ seems to be constantly getting complicated. If the major version
were to change, there wouldn't be any need for backward compatibility
with the existing code, and it would have been okay to delete that
syntax while creating an automatic formatter.
dnmc wrote 2 hours 11 min ago:
Are you suggesting we move to C++++?
dist-epoch wrote 53 min ago:
Didn't you read the article? That form is deprecated. The
recommended one is C,++,++
m-schuetz wrote 1 hour 40 min ago:
Personally I like C+. Picking the nice parts of C++, but skipping
all the nonsense. I just wish C++ hadn't deliberately screwed up
designated initializers with mandatory ordering. The C version of
it that allows out-of-order assignments is clearly superior.
zlfn wrote 2 hours 6 min ago:
It's already there. It's called C#
HackerThemAll wrote 1 hour 49 min ago:
Well, C# also has its quirks already. Like the crippled
finalizers which are never to be used. If the IDisposable
interface had been correctly designed, finalizers could become be
the "public void Dispose(void)". Or the manual passing of Task in
case of async methods, which is... kinda smelly.
tialaramex wrote 1 hour 0 min ago:
It's possible you didn't realise, but C# is sometimes said to
be named that way because # is the symbol you get if you draw
++ small and then on the line below ++ again. Hence C++++
All languages have some spikier edges, there are no languages I
know where I think "Well, even if we could start over I have no
idea how to improve this". What's notable about C++ is just how
rich that "could do better" seam is, so very many of their
defaults are wrong, so many of their keywords are the wrong
word, so many of their standard library features are allowed,
sometimes even mandated to be crap.
kstrauser wrote 45 min ago:
I donât know if thatâs true or not, but while the thought
never crossed my mind before your comment, itâs now canon
in my mind. Yes, C# is spelled C++++ with a ligature.
HackerThemAll wrote 49 min ago:
I think you meant to get that to the original poster, who
seems to imply C# is the flawless, bestest incarnation of
C\+\+(\+\+)+.
staplung wrote 2 hours 16 min ago:
Of course since the old syntax is merely deprecated and not removed,
going forward you now have to know the old, bad form and the new, good
form in order to read code. Backwards compatibility is a strength but
also a one-way complexity ratchet.
At least they managed to kill `auto_ptr`.
hrmtst93837 wrote 29 min ago:
If two template spellings trip you up, C++ is not your biggest
problem. The joke is that each 'cleanup' sands off a tiny rough edge
while the commitee leaves the old strata in place, so the language
keeps accreting aliases and exceptions instead of dropping dead
weight.
tialaramex wrote 7 min ago:
Several times now C++ enthusiasts and indeed the committee have
been told the way forward is the "Subset of a superset" that is,
Step 1. Add a few new things to C++ and then Step 2. Remove old
things to make the smaller, better language they want.
Once they've obtained permission to do Step 1 they can add whatever
they want, and in a few years for them it's time to repeat "Subset
of a superset" again and get permission for Step 1 again. There is
no Step 2, it's embarrassing that this keeps working.
Conscat wrote 1 hour 53 min ago:
PyCuda 2024, used fairly often in certain industries, still contains
`auto_ptr` ;-;
throwaway2027 wrote 2 hours 25 min ago:
C++ got too complicated after C++23 I went back to C.
jjgreen wrote 1 hour 34 min ago:
C is the new vinyl.
FartyMcFarter wrote 1 hour 50 min ago:
You can always restrict yourself to a subset of C++ that takes
advantage of RAII (resource handling is extremely painful in C), and
get performance benefits like move semantics, without the insanely
complex stuff.
I love C, but C++ has worthwhile advantages even if you heavily
restrict which features you use.
Conscat wrote 1 hour 51 min ago:
No offense intended to your perspective, but I do find it a little
amusing that C++23, which was generally considered a disappointingly
small update due to COVID complications, was the breaking point in
complexity.
lasgawe wrote 2 hours 30 min ago:
learned something new. thanks for the article.
advael wrote 2 hours 37 min ago:
This seems pretty good to me just on the level of trying to read C as
someone using C++. Parameter packs and variadic templates are easily
the most confusing syntax in C++ and cleaning it up is... very welcome
jkaplowitz wrote 2 hours 26 min ago:
Hats off for using "..." in your comment immediately after a valid
identifier word and with no comma in between, given the topic of the
article.
advael wrote 1 hour 26 min ago:
Hats off for noticing. Not to be taken for granted in an
increasingly skimming-oriented world
mFixman wrote 2 hours 37 min ago:
I used to slay with this in code golfing competitions from TopCoder,
where you had to implement a function to solve a particular problem,
thanks to C pointer maths and the gcc generally putting function
arguments in order in the stack.
Turns out, these two are equivalent in practice (but UB in the C++
standard):
double solve(double a, double b, double c, double d) {
return a + b + c + d;
}
double solve(double a ...) {
return a + 1[&a] + 2[&a] + 3[&a];
}
Joker_vD wrote 51 min ago:
double solve(double a[]) {
return 0[a] + 1[a] + 2[a] + 3[a];
}
solve((double[]){1, 2, 3, 4});
The cast in the invocation can be macro-ed away. And the best thing
is, the actual stack layout and data movement/shuffling is pretty
much identical to the approach with , and with no UB or compiler
intrinsics.
kevin_thibedeau wrote 41 min ago:
That's a compound literal, not a cast.
mananaysiempre wrote 1 hour 49 min ago:
> Turns out, these two are equivalent in practice
Not in the x86-64 SysV ABI they arenât. The arguments will be
passed in registers (yes, even the variadic ones), so how your
compiler will interpret 1[&a] is anybodyâs guess. (For me,
x86_64-unknown-linux-gnu-g++ -O2 yields, essentially, return a+a+a+a;
which is certainly an interpretation. Iâm also getting strange
results from i686-unknown-linux-gnu-g++ -O2, but my x87 assembly is
rusty enough that I donât really get whatâs going on there.)
camel-cdr wrote 2 hours 26 min ago:
K&R syntax is -1 char, if you are in C:
double solve(double a,double b,double c,double d){return
a+b+c+d;}
double solve(double a...){return a+1[&a]+2[&a]+3[&a];}
double solve(a,b,c,d)double a,c,b,d;{return a+b+c+d;}
DIR <- back to front page