« first day (89 days earlier)      last day (4860 days later) » 

10:00 PM
I'm so frequently amazed by what needs cutting from C++
 
I never really got into the Prolog mindset, either.
 
that I would rather define my language as "these features are still here, everything else is cut, and I added ths"
 
@DeadMG The problem is, no two people can agree on what to cut
 
It sounds interesting, DeadMG.
 
@Konrad: Even if I ever finish it
I am never submitting it to commitee
for just that reason
 
10:01 PM
true, true
 
they're too slow and indecisive
 
Python has the advantage here: if Guido says no, then it’s no.
we’d need a benevolent dictator for C++
 
sbi
@AlfPSteinbach No, Alf, it won't be fixed by a round of beers. I might forget it, but it won't be fixed. FWIW, I do remember you being insulting in c.l.c++(.m?) years ago. (And not to me, mind you.) Reputation is usually well-earned, and very hard to shed. And it cuts both ways.
 
yes, something like that
but
 
sbi
And you still haven't brought forth a single convincing, understandable argument against that technique.
 
10:03 PM
you know, I have other things I wish to work on and other things to do, so it hasn't had much attention recently
 
@DeadMG Don’t tell me. I’m working on my programming language project for 10 years now
still no compiler has seen the light of the world :(
I’m not what Joel would call “gets things done” ;-)
 
well
I was going to preprocess into C++
so then as soon as I finish the module system, I can start programming in it
 
If you do succeed
 
because I don't have to implement like, my own inheritance and such
 
Please keep the auto keyword
It is saving me a shitload of typing right now
 
10:05 PM
@MooJuice The one that tells you that a variable has automatic storage location? :p
 
of course I am
 
@DeadMG Just cut inheritance. It's way overrated and overused. Subtyping via interfaces is sufficient.
 
Konrad, no :)
 
the trouble is
I would love to cut inheritance
but there's so much existing code, and it serves great uses across library boundaries
 
sbi
@KonradRudolph I noticed you have avoided the "smart" part. :)
 
10:06 PM
@DeadMG Can't you just cut "backwards compatibility" with existing libraries?
 
@sbi Oh, I’m vain, make no mistake
 
no
 
sbi
@MooJuice Why are you all so obsessed about saving keystrokes when writing code? When writing code, the act of typing out my thoughts is the least of my worries. And when reading code, auto will not always be helpful.
@KonradRudolph Yeah, I noticed.
 
I think that auto is the greatest thing since sliced bread
2
 
sbi
(And I also noticed you understood immediately what I was talking about.)
 
10:08 PM
it increases type encapsulation
 
auto mobile = 42;
 
@AlfPSteinbach: I'm very sorry if I seemed to be offensive towards you or anyone else, that certainly wasn't my intent.
 
@sbi, Don't get me wrong. I only use it in some specific places where it also obvious. It's hardly ever used, but in this particular section, it is useful... basically a reference to a base-class is passed to a functor and the first line of each functor does a static_cast to the appropriate type. The class names aren't short. It is the only place I use auto. Right now, it is saving on typing.
:)
 
I use auto and decltype wherever possible
infact
 
I was talking about you buying a round of beers, so that I could see that you meant no ill by inserting a comment that could and was interpreted as if you could have written the incompetent's code.
People do things like that in the heat of the moment, they intentionally make a technical discussion personal.I don't go around keeping that against them forever.
 
10:14 PM
in DeadMG's Theoretical Language, the compiler will infer most return types for you
 
sbi
Sigh. Now that I had written a lengthy comment to@CharlesBailey asking for a clarification, he has deleted his answer, right before I committed my comment. @Charles, are you listening?
 
@DeadMG Will your theoretical language also tell me when I’ve accidentally written an identifier in lowercase instead of with an uppercase first letter? This has just cost me > 1 h of debugging since the compiler silently applied SFINAE, used another overload, and failed with a completely different error.
aaaargh!
 
I have been considering something like that, actually
 
@sbi Hello?
 
@CharlesBailey It's very much OK, because I don't remember the offense. <g> Really, I don't. Heh.
 
sbi
10:20 PM
@CharlesBailey Thanks for showing up here!
Here's my comment:
@Charles: If I have a function T f() { T obj; /*...*/ return obj;}, and I call this T val = f();, then, according to tests I made (in the 90ies, I have to admit), returning and assigning the result can be two copies made by the compiler: one to copy obj to wherever the return value resides when the function returns, and one to copy that into val. Of course, the compiler can omit any and all of them, if it feels up to.
But doing const T& val = f(); will omit one of them, and still leave the compiler free to omit the other. So what is the disadvantage of that technique?
Oh, and why have you deleted your answer??
 
I think that RVO and NRVO are very reliable on modern compilers
but I can't disagree that the const reference is more reliable
 
@DeadMG But there are situations where NRVO cannot be applied (= when there’s no one named object that is returned in all code paths)
 
OK, I only have real knowledge of the underlying mechanism on x86 and x86_64 but what happens for large objects is that the caller passes the address of a space to construct the return value.
 
sbi
@CharlesBailey That's RVO (or NRVO). That's something the compiler might do (and often does). But not always.
 
@sbi With the reference, the compiler has to do like `T _temp = f(); T const& vall = _temp;". And as you can see it's the same as without the reference, except that a sufficiently quirky compiler might do things differently in the two cases (no way to predict what, though).
 
10:23 PM
The elimination of a temporary for the return value from which the copy constructor can be used to initialize the local variable happens on both compilers that I tested at the lowest level of optimization.
 
sbi
@AlfPSteinbach No, it doesn't have to do that at all.
 
@sbi Yes, it has to: it's required by the standard that the object to which the reference refers, lives to the end of the scope. It's unnamed. That's the only difference.
 
Rather than allocate some (more) stack space and pass that to the function for the return value, the compiler simply passes the address of the (as yet uninitialized) local variable.
 
sbi
@AlfPSteinbach But the compiler can use the object it created at the return statement.
 
I think the local object "looks" more obvious and typically isn't any more expensive. I don't deny that binding a local const reference isn't no worse or better, just that in practice it's only no worse.
 
sbi
10:27 PM
@CharlesBailey Yes, that (N)RVO, I know the technique. It's easy to come up with examples where this works very nicely. But from what was discussed in c.l.c++.m ten years ago there'#s also cases where the compiler cannot do this.
 
And this is not directly anything to do with RVO or NRVO which eliminates the copy that may be made inside the function when the function is populating the return value object.
 
@sbi: I've heard of cases where RVO and NRVO cannot be applied, but I've never actually seen them
would you care to post one?
 
@DeadMG Simple:
 
sbi
Isn't (N)RVO the technique where the caller passes in the address of the storage where the callee is supposed to create the result at?
 
return rand() % 2 == 0 ? string("hello") : string("world");
 
10:28 PM
um
 
wait, there’s no named object here
forget that
but a similar case does apply when you have two different code paths which may be taken, and both create a named object which is subsequently filled and then returned
 
@sbi When I described passing the address in, that's just how return of objects that don't fit into EAX is implement in most x86 calling conventions.
 
func(void* buffer) { rand % 2 == 0 ? new (buffer) string("hello) : new (buffer) string("world")
 
It's not an optimization.
The RVO constructs the object where that address points directly rather than via a copy of an extra object.
 
sbi
@KonradRudolph So what? If only NRVO is helpful, and RVO fails more often, the more important it would be to be careful when relying on it.
 
10:29 PM
@sbi absolutely
 
sbi
@CharlesBailey But that already is an optimization.
And from what I understood, that's RVO.
 
(but it’s the other way round … RVO is what Charles is describing. This works always. NRVO is what I was failing to describe)
 
sbi
Plus, compilers can not apply this always.
 
Elimination of the temporary outside the function call determines whether the address where that object is constructed is an unnamed temporary object that is then copied or is the address of a name object that is being initialized from the returned object.
 
sbi
@KonradRudolph Ah, Ok. I always was hazy on those terms. Can you elaborate, please?
 
10:31 PM
No, I am not describing RVO. (Or I was, only to distinguish it from the temporary elimination that I am trying to describe.)
 
@sbi "But the compiler can use the object it created at the return statement." Yes, it can create that object right into the caller's stack frame (RVO, Return Value Optimization). Doesn't matter if the caller's result object is named (variable) or unnamed (temporary created for reference to bind to): at the end, the names disappear anyway in the machine code. OK?
 
Everybody clear, now?
@sbi Because it seemed to be causing offence. (Sorry, missed this before.)
 
sbi
@CharlesBailey No, not at all. :(
 
ah, found it
 
@CharlesBailey Wait. Ctrl+L. Yes.
 
sbi
10:35 PM
@CharlesBailey But it wasn't your answer which did, it was Alf's behavior.
 
I think this is the most accurate explanation on RVO and NRVO:
 
sbi
@KonradRudolph Thanks, I'll have a look at it.
 
And now, since my code finally compiles, I’m off to bed
 
g'night.
 
(now instead it has spurious null pointers – even though I don’t use pointers … much better :D)
 
10:37 PM
OK: RVO eliminates a copy in here: A f() { return A(); } ; NRVO eliminates a copy here: A f() { A a; return a; } elimination of temporary eliminates a copy here: A a = f(); .
 
sbi
10:53 PM
@KonradRudolph @Charles So from reading this I understand: 1. NRVO actually never existed, because it was only a proposal meant to support compilers, which, as it seemed at the time, wouldn't need that support. 2. RVO actually was implemented, first by Zortec, then by cfront, and only 2003 by MS. (Confusingly, Stan later refers to RVO as NRVO, which likely indicates that I misunderstood.) 3. Even by 2005, VC seriously failed to apply RVO even for a very simple test case, making one superfluous copy.
Can any of you untangle that mess in my head?
 
Nobody realy understands NRVO or has a good implementation of it by 2005
 
sbi
FWIW, VC2008 does optimize my simple test case.
And it also optimizes Stan's test case.
 
yeah
 
sbi
(All for Release only, of course.)
 
I really meant "as of 2005", since tht's all you summarized
oh
VC2009?
 
sbi
10:58 PM
@DeadMG Dammit. VC9/VS2008. That's so confusing.
 
yeah
I think that in VS2003/2005, MS were doing a lot of, say, Standard conformance work
as well as starting on .NET
so I would really look to 2008 or 2010 for a lot more optimization work
 
sbi
Also, @Charles is right in that, even for Debug code, VC only copies once, not twice as I saw in the 90ies.
 
@sbi NRVO has stood for different things at different times. It's been an evolving acronym. :-) Originally g++ had a scheme where you could actually name the return value, and that was called NRVO.
 
sbi
@AlfPSteinbach That seems to be what Stan describes at the beginning of his article.
However, later he refers to what i thought would be RVO as "NRVO".
That totally confuses me.
Anyway, he also says that such optimizations can only be applied under certain circumstances. The ones he lists for early implementations are quite drastic.
 
I'm fairly sure that they're not very drastic in new versions
 
sbi
11:06 PM
@DeadMG However, playing with it now, I could not come up with something VC9 fails to optimize.
 
@JamesMcNellis Oh, Herb Sutter speaks German fluently. We should invite him to this chat channel :)
 
hey
english :P
 
@FredOverflow I already tried to invite him to come contribute at Stack Overflow. Given that it's been seven months now, I think I may have failed.
 
> Ach, wie geht's, wir müssen dann auf Deutsch uns unterhalten!
(Herb Sutter to Eric Meijer)
 
sbi
@FredOverflow Oh, I didn't know that! But once we're at it, let's invite Scott Meyers, too. He, too, speaks German very well.
 
11:17 PM
hey guys
 
I think we should rename C++0x to German++
 
can we have the C++::Lounge or C++<Lounge>
seems to me that C++->*Lounge is somewhat off since member pointers are really rarely used
 
Maybe pointers to members are rarely used in your code :-)
 
sbi
room topic changed to C++::Lounge or C++<Lounge>: For those who don't know (N)RVO
@DeadMG Better? :)
 
Shouldn't that be Lounge<C++>?
 
11:19 PM
Yes.
 
sbi
@JamesMcNellis Not only. I'm pretty sure I've seen more template-meta code than member pointers.
@JamesMcNellis What was that referring to?
 
I always thought it was struct Language { Room lounge; }; and, ignoring that "C++" isn't really an identifier, Room Language::*Lounge; or somesuch
 
Lounge<C++> would fit better, I think; or lounge<c++> to keep the Standard Library casing.
I've used pointers to member functions a lot, though usually in refactoring repetitive UI code.
 
Unfortunately, C++ is not a valid C++ identifier. So it should really read Lounge<C_PLUS_PLUS> or something.
 
I'm talking over this lounge. Y'all have to speak Norwegian. Forstår dere?
 
11:20 PM
@AlfPSteinbach Foster parents?
 
sbi
@JamesMcNellis Ah, that would be it. I've long since learned to avoid UI code...
 
Apparently "stac" is Polish for "become." (I had Google Translate up to translate Fred's quote above and I started typing stackoverflow.com...)
 
sbi
@FredOverflow "Do you understand?" (Sounds almost German to me.)
 
UI code can either be nasty or beautiful; never in between and usually the former
 
In @sbi's world, "UI" stands for "U do it, I have better things to do!"
7
 
11:22 PM
@sbi I did too but now I get to write UI code for programs that are used to write UI code (in C# though, so no pointers to members).
 
hahaha
 
sbi
@JamesMcNellis Uh. That makes my head hurt.
 
11:46 PM
is it just me, or does giving Noah the kindest interpretation possible still make no sense?
 
wow
 
sbi
Well, just keep flagging the guy, and he will end up in the penalty box.
 
Maybe he was dropped on his head as a child?
 
@FredNurk His answer only makes sense as sarcasm (as I see it).
 
@AlfPSteinbach hmm, I was thinking he understood what short-circuiting is, but I can only interpret as sarcasm if I wasn't that kind
@sbi the new flagging interface has interesting possibilities towards applying them more liberally, but I still hesitate
 
sbi
11:51 PM
@FredNurk Yeah, I noticed, too, with that other highly controversial question today. Why hesitate?
If he behaves rude, flag.
 
I think the answer referenced above, containing no rude language, is rude, but on the other hand the answer discussed earlier, containing (what some feel is) rude language, is not rude but just factual. But that's my viewpoint. I'm looking mainly at implications, not about direct association.
 
sbi
Most hilarious up-vote comment I've seen this year: "+1. I've always preferred Bar to Foo anyway. Down with Foo!" :)
 
Oh, amendment.
 
@sbi two reasons, the new useful options imply moderators need to act on them while I'd rather not increase their workload frivolously, and I don't see flagging as appropriate for "this answer is wrong" (nor do I downvote for that)
 
There was some elaboration in the earlier answer.
And that was uncalled for.
@FredNurk I downvote for answer is wrong. What else should downvote for, if not that?
 
sbi
11:55 PM
@AlfPSteinbach You will have to accept that what's rude or not isn't universally agreed upon, but is a majority decision in any society. So if most readers her in this community think what someone wrote is rude, then, by definition, it is indeed rude - no matter how unconvinced you are.
 
Agreed. If an answer is wrong, downvote it and comment with an explanation. (Or downvote it and upvote another comment explaining why the answer is wrong. Or don't downvote it if it's been downvoted to more than -N where N is like 3 or something but still upvote the comment explaining why the answer is wrong.)
 

« first day (89 days earlier)      last day (4860 days later) »