« first day (1178 days earlier)      last day (3996 days later) » 

16:00
¬_¬ and yes I know it's not really a franchise, fuck it
posted on January 06, 2014 by Herb Sutter

Now the unnecessary headers have been removed, and avoidable dependencies on the internals of the class have been eliminated. Is there any further decoupling that can be done? The answer takes us back to basic principles of solid class design.   Problem JG Question 1. What is the tightest coupling you can express in C++? […]

posted on January 06, 2014 by Herb Sutter

This GotW was written to answer a set of related frequently asked questions. So here’s a mini-FAQ on “thread safety and synchronization in a nutshell,” and the points we’ll cover apply to thread safety and synchronization in pretty much any mainstream language.   Problem JG Questions 1. What is a race condition, and how serious […]

ah!, damn you feeds. made me jump
@EtiennedeMartel well... I guess it sort of is... who owns the IP?
16:02
@thecoshman As long as jou are not trying to time your jumps, you will be OK.
@thecoshman Sega does.
@MartinJames it took me nan seconds
@EtiennedeMartel and who makes Sonic games?
@thecoshman Heh.. luckily, with my systems, I can get away with a couple of cooking timers to ensure sufficient performance.
@thecoshman A bunch of people. Usually Sega.
That said, it's not just games.
There used to be TV shows.
And let's not forget about all those wonderful tie-ins.
¬_¬ no, please do let us forget... about everything to do with sonic.
16:07
So, it's a franchise alright.
@EtiennedeMartel grumble grumble a shit one though grumble grumble
> So someone took a shit in the back alley of my workplace: he wiped his ass with some ice
no reddit, I will not look at that ಠ_ಠ
    template <typename T>
    using Not = Bool<not T::value>;
@R.MartinhoFernandes wut
user3010322
16:23
@LightnessRacesinOrbit How in the world can you have too much disco?!
16:35
@melak47 What about it?
It's a meta-boolean negation.
yeah
msvc doesn't seem to know about it :D
Alternative token.
I am not too keen on <!T... as I find it hard to read, or, to put it another way, easy to miss. Symbol density too damn high, I guess.
msvc doesn't know anything
@melak47 Ah. On MSVC you need to #include <iso646.h> or something.
Quite silly, but well
not like wheels will compile if I do anyway >_>
16:37
hehe
Were you trying to run my nonius code?
yes >_>
trying to rip wheels out of it <_<
user3010322
Wheel the wheels right on out of it. :D
user3010322
3 hours to interview doom.
user3010322
yo
16:43
error C2446: ':' : no conversion from 'std::chrono::duration<std::chrono::system_clock::rep,std::chrono::system_clock:‌​:period>' to 'double'
._.
@R.MartinhoFernandes I’ve been figuring out ninja. Neat results. I’m a bit disappointed that I couldn’t use ‘variables in a rule are expanded late’ for profit though.
user3010322
Lol.
user3010322
Get good, son.
Xeo
Xeo
Well that was fun. Almost collapsed in front of the doc due to vertigo and nausea.
                volatile auto ignored = Clock::now();
                (void)ignored;
user3010322
16:44
o.0
user3010322
What the hell. D:
(void)ignored?!
Xeo
Xeo
Dunno. Was the first time in quite a while.
@melak47 Ignores ignored.
user3010322
@melak47 Don't optimize it out.
Xeo
Xeo
It's a sign to the compiler to shut up about unused variables
16:45
@Xeo you do this regularly? :)
@LucDanton how's that? They weren't expanded late? Or ... you just didn't have the use case?
@Xeo okay. looks weird (cast to void? o.O)
Xeo
Xeo
expression of type void, yeah
user3010322
@melak47 You can c-style cast anything.
Xeo
Xeo
@ThePhD got nothing to do with that
void(blag); works just aswell
user3010322
16:46
Hm.
@sehe Former. Use case was reducing verbosity (the build file being generated means it’s low priority though).
user3010322
Interview in 3 hours
user3010322
Because Amazon derped, the microphone and super awesome headphones I wanted for the interview are now half a country away.
@LucDanton Is this a missing feature or a bug? (I agree, it's a killer feature in my book. Even with GNU make. SECONDARY_EXPANION FTW)
user3010322
I have no idea what they're going to ask me.
user3010322
16:47
I'm pretty anxious, going in fairly cold turkey on this one.
@ThePhD If that's the most neglected part of the preparation...
It’s supposed to be a feature but I can’t figure out what I’m doing wrong.
user3010322
@sehe I'm exceptionally bad at listening to people with certain accents.
Oh. Interesting
user3010322
French-like is one of them.
user3010322
16:48
I got the headphones so I could crank up the volume and hear everything clearly, for my bad ears.
user3010322
Now I gotta do it rogue with some terrible monitor speakers.
@ThePhD Oh you too :/ We have daily standups here and part of the team is the Ukraine. I can tell you, I hardly follow a word they're saying. :(
Everyone else seems to think it's no problem though
user3010322
Seriously! I don't know how they do it. I feel like maybe if I spent enough time around the accent maybe my brain could adjust?
@melak47 Wait, that is wrong. Where?
user3010322
I feel bad too: makes me feel like a stuck up snoody englishman. D:
16:50
@ThePhD No, that's the volatile. The (void) is to "use" the variable and shut the warning.
it doesn't like this: int n = std::ceil(time_limit / elapsed);
@ThePhD Nothing to do with bad ears, I suppose. More with an active brain (highly associative and ... perhaps a slight bit autistic? It takes me ages to figure out what people were actually trying to phonemize)
@melak47 WTF? Does their op/(duration, duration) return duration or some bullshit?
@ThePhD Yup me too. No problem with french accents here. German and, apparently, Russion accents are the worst though
@R.MartinhoFernandes looks like it :D I did a .count() on both :S
16:51
Yay for subverting nice libraries
Sep 13 '12 at 0:06, by sehe
@MooingDuck Time To Leave Grand Hotel
My physics teachers would have a stern word with them.
@sehe Neither. Ninja files are minimalistic by design. Any real work is meant to happen in the generator.
@melak47 What. The. Fuck.
That's so broken.
File a bug.
@R.MartinhoFernandes they don't listen to my bugs reports ._.
@R.MartinhoFernandes maybe plink @Luc
Xeo
Xeo
16:53
@melak47 Mail STL
@melak47 It's a common idiom for "discard this value".
@R.MartinhoFernandes so it's supposed to return a common_type of the duration...instead it returns a duration of common_type :D
Xeo
Xeo
@melak47 Common type of the representation-types
Can you dig the operator/ up?
Xeo
Xeo
I'm curious how the fuck that's implemented, with which semantics.
user3010322
16:55
I can send the bug to STL.
wait no, it looks fine :/
user3010322
I have to wish him a happy new year still.
Then why is there a duration->double conversion going on on that line?
Xeo
Xeo
@melak47 So you fucked up?
I see no other possibility.
16:56
misread, the template density is too damn high :p
@LucDanton Wait, I think I misunderstood what you meant.
std::ratio<0x01,0x0989680> WTF
yeah, uh..that's also interesting
I guess their system clock has a weird period.
17:01
AFAICT I expected variables to ‘propagate’ across the graph (i.e. true dynamic scoping, no?), but it doesn’t do that. Only the variables of a particular build are used by the associated rule.
That would make my ‘workaround’ the proper way to do it then!
blargh
Wait. environment.h++:72 is times.reserve(n);
I had to shuffle some includes
Oh, I guess you added an include.
wheels and all
17:04
Right.
That seems quite the brokens.
so...do I just slap .count() on both and see what else breaks? :S
Yeah.
Wait, no.
Let me check.
Xeo
Xeo
dig up the impl of operator/ for durations please
@melak47 Yeah, don't do that.
time_limit and elapsed are not the same duration type.
wtf is up with their indentation
Xeo
Xeo
17:07
huh, looks correct
is elapsed no a duration or something?
@Xeo One is FloatDuration<Clock>, the other Duration<Clock>.
@rightfold using rightfold = clang-format-bot;
user1804599
using rightfold = tab-remover;
(Almost the same, but the former is forced to have rep as double)
Xeo
Xeo
17:08
then I don't get it
@Xeo Doesn’t look too SFINAE-friendly, if that’s ever a concern.
user3010322
namespace Prison {
     const static auto unusable = rightfold{};
}
user3010322
D:<
@melak47 Can you struct{}_=decltype(time_limit){}; and struct{}_=decltype(elapsed){};?
needs {}
17:11
Right.
"expected primary-expression" is not too helpful.
nonius/environment.h++(72): error C2440: 'initializing' : cannot convert from 'std::chrono::duration<double,std::ratio<0x01,0x0989680>>' to 'nonius::estimate_clock_cost::<unnamed-type-_>'
thats time_limit
and
error C2440: 'initializing' : cannot convert from 'std::chrono::duration<std::chrono::system_clock::rep,std::chrono::system_clock:‌​:period>' to 'nonius::estimate_clock_cost::<unnamed-type-_>'
Ugh, fuck you MSVC, thanks a lot.
Does it expand what std::chrono::system_clock::rep and std::chrono::system_clock::period are in the following text?
Xeo
Xeo
does that matter? both operands are durations
17:14
it doesn't :/
Xeo
Xeo
so it should select the right overload
Well, whatever. What of decltype(time_limit / elapsed)?
Xeo
Xeo
and yield an arithmetic type
error C2446: ':' : no conversion from 'std::chrono::duration<std::chrono::system_clock::rep,std::chrono::system_clock::period>' to 'double'
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1> D:\Files\Dropbox\c++\vc12\ConsoleApplication2\ConsoleApplication2\deps\nonius/environment.h++(72) : see reference to class template instantiation 'std::common_type<double,Duration>' being compiled
1> with
1> [
Xeo
Xeo
17:16
just wtf
What's in type_traits(1446)?
template<class _Ty0,
	class _Ty1>
	struct common_type<_Ty0, _Ty1>
	{	// type is common type of _Ty0 and _Ty1 for two arguments
	typedef typename decay<
		decltype(_Always_false<_Ty0>::value
			? _STD declval<_Ty0>()
			: _STD declval<_Ty1>())
	>::type type;
	};
the ":"
lol?
haha, no way.
17:17
?
What are the arguments to the instantiation?
I wanna laugh, too
@LucDanton double, Direction, see log above
9 mins ago, by Luc Danton
@Xeo Doesn’t look too SFINAE-friendly, if that’s ever a concern.
> see reference to class template instantiation 'std::common_type<double,Duration>' being compiled
gief cookie
@melak47 It tries the first overload, and it hard errors there instead of SFINAE.
brb making tea, to go with cookie
evening lounge
17:19
@LucDanton :D
@melak47 IOW, <chrono> broken on MSVC.
just stop this silly SFINAE nonsense, it's all your fault
@melak47 What? The SFINAE is in the stdlib.
Failure is not an excuse?
;D
It's the SFINAE from the stdlib that is broken.
I have no SFINAE at all in nonius.
The only templates I have are straightforward for letting you pick Clock, IIRC.
I'm curious how this got past untested.
user3010322
Music too strong.
17:22
this isn't even the CTP
it could be even brokener there :D
Any test of this feature would bring the error.
user3010322
@melak47 "RTM Quality" ._.
@R.MartinhoFernandes Perhaps the question is the answer here.
@R.MartinhoFernandes ain't nobody got time for that
user3010322
Now you guys know why I want to join the STL team?
17:23
It's really the kind of bug that only passes by if they just slap it together and don't even bother testing.
fuck, they started accepting my answers when I'm way over rep cap. they should've done it yesterday @#$%$$#@
user3010322
We need a Lounger on the inside
user3010322
Who can fix bugs ASAP.
@ThePhD Because you would fit right in? SCNR.
@BartoszKP accepts go over rep cap
user3010322
17:23
@R.MartinhoFernandes q__q
@ThePhD Wrong approach.
user3010322
my heart.
I don't care about fixing this bug.
user1804599
I hope tomorrow’s weather will be as nice as today’s.
There is no test for this feature in the stdlib test suite.
17:24
@nightcracker yeah, I know. but yesterday I didn't have a feeling of fulfilment :( and today I already have
Letting you mix and match durations of different types is pretty much the raison d'être of <chrono>.
So yes, I think this is quite embarrassing.
@R.MartinhoFernandes what does estimate_clock_resolution return?
@melak47 4
It's chosen by a fair dice roll!
@nightcracker thanks :)
@melak47 FloatDuration<Clock>.
user1804599
17:27
Hmm.
@R.MartinhoFernandes no, I mean what does the return value represent?
user1804599
If I have 1000 tests, will python -m unittest print 1000 dots? :v
@melak47 The estimated resolution of the clock. Smallest measurable period.
measured in what?
Whatever the clock uses, but forced to be double because it's a mean.
Xeo
Xeo
17:30
what a mean function, forcing the poor representation type
@melak47 If you want to print it and make sense of the result use fs(value).count() as in main.
@Xeo what do you mean?
;)
@R.MartinhoFernandes I could do that....if it was compiling with estimate_clock_cost you joker :p
so far the estimated resolution is all I get :p
Well, if the periods of time_limit and elapsed are the same, you can divide the count()s.
They should be, bar bugs.
typedef ratio_multiply<ratio<_XTIME_NSECS_PER_TICK, 1>, nano> period;
where that define is 100
17:33
Wait, what.
How in hell.
that's system_clock::period :D
Oh wait
0x0989680 is hexadecimal.
I kind of overlooked that because WTF
Right, 10000000 seems perfectly cromulent.
@melak47 So yeah, they match.
blergh, okay, now I can't convert what you are returning in time() from an initalization list to a....duration of Duration<Clock>, with result tuple<vector<duration<clock>>, int>
Whaaa
There's no tuple :S
TimingOf<Clock, Fun(Args...)> time(Fun&& fun, Args&&... args)
TimingOf is an aggregate.
well yeah, but you deduce the return type of Fun
and that's a tuple of vector of stuff and stuff
17:39
Is it Fun doing the init list or something?
You mean this return? return { delta, std::forward<decltype(r)>(r) };?
Oooooh, benchmarking lib?
@LucDanton Yes.
@melak47 Do you see why I don't even bother with such a bullshit compiler?
user3010322
17:42
=[
user3010322
I'll never see ogonek for as long as I love. u.u
user3010322
At least, not until Visual GCC catches up and I get shiny debugger and other things inside of VS.
Xeo
Xeo
easy solution: stop loving
user3010322
@Xeo But I can't stop loving you, Xeo-chan~
2
Alright, I have my tea. Time to try ninja-ifing my stuff. I expect blood and tears.
17:43
@ThePhD Should have posted Phil Collins video.
user3010322
クセオちゃん~
user3010322
@R.MartinhoFernandes I know, a wasted oppportunity. :c
Xeo
Xeo
ohey, he got it right for once
user3010322
I did?
user3010322
I spelled it like I usually d- OH I messed up teh order.
Xeo
Xeo
17:45
"d-OH" indeed
@melak47 I have no idea how to fix this. Can you post the error?
(Did you file that bug?)
@R.MartinhoFernandes the errors is I probably fucked up copy pasting types around instead of trying to replace wheels::meta::result_of ^_^
@melak47 Well, use std::result_of, and change the invoke(fun, ...) call to fun(...). That should work for this.
Yes, less SFINAE-friendliness is exactly what’s needed :D
@LucDanton No SFINAE on this.
There are no overloads.
17:48
… so far!
Erm, this is just a hammer to get it to run this one time. I'm not planning on supporting MSVC.
@R.MartinhoFernandes it does. yay ^_^
user3010322
=[
user3010322
y u no lav VC++
@R.MartinhoFernandes boo :{(
user3010322
17:51
Wait, who starred that loving message? D:
@ThePhD I have enough bullshit errors to deal with.
user3010322
Doyou know what TonyTheLion and ScottW are going to do to me? D:
user3010322
@R.MartinhoFernandes Fair enough.
Actually, nowadays I really don't because GCC is quite good.
user3010322
u.u
user3010322
17:52
Yeah yeah, rub that 4.9 goodness in my face some more.
Used to, but not so much.
user3010322
BUT YOU"LL SEE
That reminds me, I’m thinking of moving on to -std=c++1y. Any reason not to?
user3010322
ONE DAY, VS WILL HAVE MINGW AND A GOOD DEBUGGER INSIDE OF IT
user3010322
I WILL CONQUER GDB AND IT WILL BE GLORIOUS.
17:53
VS + LLVM Build will be glorious-er
user3010322
No debugger.
user3010322
Do not care.
And then, <chrono> is broken. I don't think that combines well with a benchmarking lib. Just saying.
@R.MartinhoFernandes it's estimating the cost of the clock at 7.8 ns :)
user3010322
LLVM Build's approach is my old approach to Visual GCC.
17:54
@melak47 Is the resolution somewhere near that?
user3010322
I do not want to go the "let's make a transformer" route.
@R.MartinhoFernandes I wanted to try boost::chrono next, but you liberally use std::chrono__duration and stuff everywhere, don't think they mix :E
user1804599
Write decent code and you don’t need a debugger.
user3010322
You always need a debugger.
user3010322
So you can fix your code against test cases.
user1804599
17:55
Code without stupid UB on every line.
@melak47 Actually, I use my own alias template!
I should make a typedef for high_resolution_clock though.
There might be a few instances of std::chrono::seconds or something, though.
@melak47 So, what's the resolution?
1000057.282913 ns estimated resolution
7.719191 ns estimated clock cost
:E
It still pains me that in VS2012 high_resolution_clock is a scam...
How did you print that?
user3010322
Lulz.
17:57
@Borgleader Oh.
That... might make sense.
std::cout << std::fixed << fs(resolution).count() << " ns estimated resolution\n";
std::cout << fs(nonius::estimate_clock_cost(resolution)).count() << " ns estimated clock cost\n";
I read an answer saying its a typedef for system_clock =/
nowadays i always use cycle counts anyway
high resolution clock is mfucking awful :)
@Borgleader it is.
17:58
Yeah, forgot high_resolution_clock is crap on MSVC.
user3010322
@Borgleader It is.
So that crazy value might make some sense.
Which is bullshit, why the fuck would they do that!?
that's why I wanted to try boost::chrono::high-resolution_clock next :)
user3010322
It's allowed by the standard.
user3010322
17:59
It's shitty, but it's allowed, and it's a bit of a copout.
user3010322
IIRC, you can't make a High Frequency clock on windows because of the way the "Frequency" bit is gotten (i.e. through a WinAPI function that's not constant).
@melak47 Wait, did you change fs?
user3010322
And IIRC, <chrono> requires a constant value for the ratio.

« first day (1178 days earlier)      last day (3996 days later) »