« first day (1446 days earlier)      last day (3506 days later) » 

8:00 PM
I remember reading somewhere that OpenMP support could be built into compilers with C++ generalized attributes rather than pragmas. Is there any implementation that currently does that?
 
nope
 
hi zneak
 
@AndyProwl I use it to watch US netflix with my NL account
 
hello Johan, it's been a while
 
@AndyProwl So if you simply passed x, then it would infer T&?
 
8:01 PM
@TemplateRex I only have a company laptop, not sure I can install that kind of things on it
@Sofffia yes
 
@AndyProwl i c
 
in fact, I cannot even install VirtualBox for running linux
and I need that for hacking Clang I'm afraid, so probably I'll have to buy a new PC
 
i think I have owned a pc better than one at work for quite a while
 
@Xeo I remember those flipons, quite handy (pun intended)
 
8:04 PM
-8
A: How to assert a bad question

user1771315this Robert Harvey guy was the same guy that killed one of my CRM questions a few hours ago. Now he's in here killing C++ questions??? Robert do you know anything about CRM 2011? Or C++ for that matter? Or are you an expert on everything?

 
Ell
I may have already mentioned it but
 
Ell
My friend has to learn C for his physics degree
 
@Mysticial upvoted on matter of principle
 
Ell
Lordy I expected FORTRAN or something
 
user1804599
8:08 PM
@Ell Poor guy.
 
user1804599
So poor he's Ritch.
 
@sehe lol, i know the camera movement is not working correctly, i'll try to fix it asap
 
@rightfold No.
@Ell Why does he?
Are physicists required to know programming in C?
 
wait, auto x = 42.; is different from auto x = 42.f;?
(herb's talk)
 
double vs float
 
8:11 PM
ah
 
user1804599
One x is double and other x is float.
 
I would expect 42. to be a double
 
tnx, silly me
 
Given the "double or long unless specified" rule or something along those lines.
 
say about Herb what you want, be he is one convincing presenter
@Sofffia it's a big step up from a decade ago when they learned Fortran
 
8:15 PM
@zneak Can you apply attributes to statements?
 
Actually I know a physicist who uses C++ for huge simulations.
 
@Sofffia the one who spoke at CppCon?
 
One night I was drunk and I explained smart pointers to him.
The next day and p much every time he sees me he thanks me for that.
 
Why is a joke I posted three years ago on the starboard?
 
@TemplateRex ?
 
8:19 PM
@Sofffia go google cppcon for "simulation"
 
It wasn't him.
 
oh man
seeing something like Crysis after so many years of Baldur's Gate equivalents
 
Still waiting for the courier?
 
I feel like I've been living under a rock
 
I just saw a commercial and they were dancing to thriller
completely butchering said dance
 
8:20 PM
@R.MartinhoFernandes no, I'm already done with him
I need to stream games to my TV via the laptop
 
Django URLconf also sucks
 
this is too good to waste on a shitty monitor
 
I want a new framework
 
user1804599
Werkzeug.
 
8:25 PM
@CatPlusPlus Why?
 
Namespaces aren't summed together
 
On that I agree
 
@TemplateRex I'm not completely convinced about his new guideline for setters on accepting by const & then copying, rather than accepting by value then moving
 
Namespacing in general is terrible in Django
 
@TemplateRex Not really lol
Herb's one of my least favourite speakers
 
8:26 PM
E.g. app labels.
 
@AndyProwl I prefer to add one && overload
 
doesn't scale well
 
@Rapptz for single arg setter you don't need to scale
 
they're supposed to be 'general guidelines'
 
IMO it's premature optimization in most cases
taking by value + moving is simple
 
8:28 PM
so by default just const&, first fall back is to add && overload
 
why are you special casing a general guideline?
@AndyProwl It scales better too
 
@TemplateRex yeah that's Herb's guideline
@Rapptz right, but even when talking about just one argument
 
@AndyProwl the value thingy has noexcept issues
 
I think it's simple and mostly efficient
 
@TemplateRex protip: don't use noexcept when you can't keep it
problem solved
 
8:29 PM
@TemplateRex is noexcept so important in a setter?
it's not a move constructor or a special operation
that would be important because of std::vector etc.
 
that was part of Herb's argument
 
@AndyProwl I think so, it's an existing object and you just watn to change a value
why on earth would you throw?
 
wait, just to refresh my memory
 
it's not because you would throw
 
no issue when you pass an rvalue, right?
 
8:31 PM
it's because the operation might throw
 
Where did you dispose of the shovel?
 
you can't guarantee the operation won't throw
 
and when you pass an lvalue, you know there's a copy involved, so you know it might throw
 
use noexcept operator if it's such a big issue
 
the function says "I won't throw", which is correct. If you copy-construct something into its argument, it's you who is throwing, not the function
 
8:32 PM
there are even std::is_nothrow_* traits
 
@AndyProwl Howard Hinnant has also been pointing out here on SO that const& + && overloads is better than single by-value overload
 
@TemplateRex I'm aware of that, yes, which is why I'm struggling with the idea instead of ignoring it
 
where was this?
 
and if you're writing a library, then it makes sense that you don't want to make everyone pay for the simplicity you choose to adopt
and then providing two overloads is the best option
but for normal application code, it doesnt' convince me
simplicity is most important there and I'm also not convinced by the performance argument
it depends on how often you pass lvalues vs rvalues
 
13
A: Efficient use of move semantics together with (N)RVO

Howard HinnantI like to measure, so I set up this Object: #include <iostream> struct Object { Object() {} Object(const Object&) {std::cout << "Object(const Object&)\n";} Object(Object&&) {std::cout << "Object(Object&&)\n";} Object& makeChanges() {return *this;} }; And I theorized that some...

p3 (const& + &&) vs p4/p5 (by-value)
 
8:35 PM
and how expensive the copy is, and so on... one benchmark for std::string alone is not good data IMO
> It is a judgement call as to whether one wants to pay an extra move construction to save overloading (and there is no one right answer).
^ This is what I buy
 
@AndyProwl but even for lvalues, say string, there is SSO and also 50% chance that existing capacity is larger than new one (just citing Herb)
 
So..
 
@TemplateRex yes, but you pessimize rvalues
 
he likes... both?
 
so if you always pass rvalues you end up with a penalty
and my feeling is that most of the time I write either obj.set_name("John") or obj.set_name(std::move(n))
 
8:37 PM
What's discussed atm`?
 
Herb's guideline on how to accept parameters in setters
 
also the question isn't so much about parameter passing but (N)RVO
 
@Rapptz and the prob. that capacity reuse can be utilized
btw one case Herb forgot is that the SSO falls within the f(X) column
 
> My favorites are p3 and p5.
 
Do you sometimes concatenate like this: return "Error: " + std::string() + exc.what();
 
8:39 PM
no
 
if you know the SSO applies (say for string literals that you type yourself, less than ~15-20 chars)
 
std::string(exc.what())
 
user1804599
return "Error: "s + exc.what();.
 
or ^
 
@R.MartinhoFernandes well, isn't that why they (not sure who exactly) say that functional languages are easier for lay people to start with?
 
8:40 PM
@TemplateRex nope
@Rapptz kinky
 
@StackedCrooked I was reading Concurrency In Action this morning, and I came across a passage where the author says something about a case of UB causing someone's monitor to catch fire. Do you think he was joking or could that actually have happened? Call me naive but I can't decide whether or not he's joking.
 
@AndyProwl a hypothetical program p6 that only has the const& overload would have a row with 1/0, 1/0, 1/0 in Howard's table
so only p3 is better in all cases
 
@TemplateRex how can it be better if I always pass rvalues?
 
@Borgleader he's not joking
 
(or most of the time, say)
const T& would always copy, while T would always make two moves
 
8:48 PM
but p4/p5 only win for prvalue, maybe win for xvalue but pay extra for lvalues
 
@Borgleader But I suspect the probably the UB was inside driver code.
 
@AndyProwl it depends on what you know about your callers
 
@StackedCrooked Yeah that's what I imagined would be able to cause this, either driver code or OS.
 
@TemplateRex they do. My point is, without knowing your usage patterns, you can't tell which is best
 
Fuckin forms
 
8:49 PM
for library code you cannot assume anything
 
I want to only load stuff that's already selected
urgh
 
@TemplateRex exactly. But only for library code
 
I hate UI
 
for application code, or detail:: helpers, you know better
 
For application code, I favor simplicity
because I don't know how often I pass rvalues wrt. to lvalues and unless the profiler tells me I should do something more complicated, I won't
 
8:50 PM
@AndyProwl but most of the code you write you write at least for your future self, so it's "librarish"
 
@TemplateRex no, not most of the time
not for me at least
 
@StackedCrooked Anyway, so far I'm really enjoying the book, thanks for the suggestion :)
 
in fact I very rarely write library code with a potentially broad range of users
 
@AndyProwl but if your application is well modularized, each module is a semi-library
and at least reusable, and pretty soon you have an unknown caller set
 
@TemplateRex it's well-decomposed, yes, but it doesn't have a potentially unknown range of users
I don't worry too much about future use cases. If they will come, and the library won't fit, I'll update the library. Unit tests will help me catch problems.
 
8:53 PM
@AndyProwl the same can be said of doing const& by default, and optimize for purrrformance when you have a bottleneck
 
@TemplateRex valid point. But my feeling is that most of the time I pass rvalues to setters
which is why I believe by default taking T is going to help
 
@AndyProwl in any case, why are you having setters in tight loops / high-performance code?
why not initialize in constructors
 
user1804599
lol mutable objects
 
I always initialize in constructors
but sometimes you just have to change things at run-time
 
@AndyProwl the key word sometimes
doesn't sound performance critical
 
8:54 PM
it's not
 
Herb's guideline is inconsistent anyway
 
I'm just saying why pessimizing prematurely
 
'use const T& and T&&!'
'..except in constructors where you should use T'
 
it's not like I pick T because I want to squeeze performance
 
@Rapptz in constructors with many args, do perfect forwarding
 
8:55 PM
It's because it's simple and probably by default faster
if it's not... most of the time won't be a problem
 
perfect forwarding of what?
wtf?
 
@AndyProwl T + std::move + dodgy exception status?
 
'dodgy'
 
i don't call that simpler than C++98 const&
 
do you stick noexcept on everything?
 
8:56 PM
@Rapptz yes
I follow Scott on this
 
terrible idea
 
I share @Rapptz's viewpoint here, for me the noexcept is not so important on setters
 
don't stick noexcept when it's out of your control or you can't keep it
 
also, I don't find it dodgy
 
any recommendations on the cppcon vids?
 
8:57 PM
that's a free std::terminate for using your library code
 
@Rapptz no of course not, I stick noexcept when I know it can't throw
 
I know that if I copy-initialize a function parameter, it's still in caller's territory
 
then how is it 'dodgy' for passing T?
 
@bamboon Yeah watch something fun instead
 

« first day (1446 days earlier)      last day (3506 days later) »