« first day (2171 days earlier)      last day (2770 days later) » 

user1804599
1:24 PM
yay
 
1:35 PM
@xeo the devector can't meet a particular exception requirement from vector, at least not universally
vector says that push_back must have no effects even if T has no non-throwing move constructor or copy constructor, and the copy constructor throws
we can not guarantee this if we're just shuffling elements around, and not doing a reallocation with new memory
 
you would have to reallocate if you can't construct in-place
moving the elements around wouldn't be enough
 
Xeo
@orlp You mean because of capacity stealing?
 
@Xeo yes
sometimes we do a 'reallocation'
that doesn't actually get a new memory buffer
because we found that stealing half the capacity of the other side is enough to fulfill the requirements for this side
(this is needed to prevent infinite memory usage on FIFO queues)
 
Xeo
You'd need to shuffle stuff back otherwise
 
@Xeo can't do that
we have no non-throwing way of shuffling stuff back
 
Xeo
1:43 PM
right
 
no, we just can't meet this requirement
I'll add documentation
that says I have relaxed this exception requirement
(seriously who writes not noexcept move constructors with throwing copy constructors anyway)
 
Xeo
vOv
 
wait
I'm pretty sure that the Standard does not permit types that are non-copyable and non-nothrow movable
 
@Puppy I'm talking about a type that is movable or copyable but none of those are nothrow
 
ah well if you have a copy constructor doesn't matter if it's nothrow or not
 
1:46 PM
@Puppy it does if you're not allocating a new buffer
 
then allocate a new buffer
 
@Puppy I won't
 
why not?
 
I have enough memory
 
who cares? you can't use the extra capacity on the other side
 
1:47 PM
@Puppy I can, by moving the elements
 
not if you don't have nothrow moves
like, say, basically every C++03 class, ever.
 
I can, by saying 'fuck you if you throw'
 
you could do, but it would be massively more sane and might make the class remotely usable if you just did a reallocation in this case.
 
@Puppy no it wouldn't
if you'd use it as a FIFO queue
you'd constantly reallocate
 
why?
 
1:48 PM
let's say XXXX is your data
XXXX________________
at the start you have a lot of empty space at the back of the devector
so you start doing some pop_fronts and some push_backs
__XXXX______________
you keep doing this
_______________XXXX_
 
yeah, so the X's all end up at the end and you have to reallocate
 
so instead of getting a new memory buffer
 
@orlp this seems a bit like people bitching that realloc can give the same buffer if the new size is smaller than the original malloc
 
when it's at the end
 
it's largely irrelevant
 
1:50 PM
I just move the data back to the middle (ish)
 
yes, I know that's what you'd like to do.
all I'm saying is that given the massive number of existing classes that can't ever meet your constraints, and the fact that paying a bit more performance is a lot more sane than, say, random UB at runtime, it's a dumb thing to do
in the happy case where you have nothrow move you can just move it back into the middle but in the other case, you should just allocate a new buffer and copy the elements into the middle of that instead
 
another alternative
is to increase the memory requirements
such that there will be no overlapping std::copy
 
another alternative is for the user to just get the right fuckin' data structure.
if they need massively good FIFO performance why are you even bothering with a devector? that's not what a devector is good for.
 
regardless, I still need to implement each operation as efficiently as possible
 
you also need to actually implement each operation
 
1:54 PM
true
 
and not just say "In this case, which is an incredibly common case, RANDOM UB AT RUNTIME!"
 
it still wouldn't be UB
it's 1. you're using it as a fifo 2. you have a non nothrow move constructor 3. your copy constructor throws 4. you expect the devector to be unmodified after feeding it throwing objects
 
which is entirely sane
considering that you can still offer the good performance in the fast case by just using some type traits
 
but muh more code ugh
but fine
I'll increase memory requirements I think
 
Xeo
btw, what happens if the shuffled-around elements throw?
 
1:56 PM
@Xeo you have to be more precise
when?
 
Xeo
This situation, where you wanted to steal capacity
 
yeah, but you have to be more precise
you mean throw when I start shuffling them?
 
Xeo
ye
 
well, if they have a nothrow move operator, that doesn't happen :P
if the ranges do not overlap
 
Xeo
right, but if you don't
 
1:57 PM
I just destruct what I have copied so far
and nothing has changed
if the ranges do overlap
 
Xeo
and when they don't, you'd need to alloc anyways, no?
 
well fuck you
 
if they have a nothrow move operator you can move them around as much as you like
the overlapping ranges don't matter that much
 
Xeo
so may as well alloc always if there's a chance of throwing. vOv
 
@Xeo right now, yes
but if I increase the memory requirements
such that we only start shuffling around elements if we can fit the entire devector in half the capacity of the other side
(which, if you do the math, means the total devector will have at worst a memory usage of 3x the actual stored elements in the FIFO case)
then we can always do that shuffle exception-safe
 
Xeo
2:00 PM
that leaves a lot of capacity on the pushed side, then. old size + half capacity
 
yes, this is a tradeoff of memory vs performance
 
Xeo
or third capacity? something or other
 
it also means it'll take longer until you hit the limit again
 
this structure simply doesn't make a good FIFO queue so I don't know why you're so concerned about that use case
 
@Puppy if I had the full power of virtual memory, it could be amazing :P
you'd never even have to move any elements
just add/remove pages to the buffer on the left/right as you go
one can dream....
 
2:28 PM
that can't work indefinitely
 
Hi itches.
 
@Puppy once we have 128 bit machines, it can :)
@Puppy but even if it can't, copying the data once every... 2^32 addresses should fix that
 
user1804599
2:42 PM
You have to be cautious about existing pages.
 
@rightfold yeah, as of now it's still a dream
 
I'm doing my other homework.
Fuck OCaml.
 
user1804599
Lol
 
user1804599
OCaml is great.
 
Ell
It is
I do Haskell again this year I thinj
I'm looking forward to it
 
user1804599
2:46 PM
Nice.
 
user1804599
Haskell is great.
 
user406009
At least OCaml is better than Matlab.
 
Literally everything is better than Matlab
 
user1804599
Is Tcl better than Matlab?
 
user1804599
Is Matlab bad or are you bad?
 
2:52 PM
Is a pile of shit better than a stack of shit?
 
user1804599
Yes because it has an emoji
 
user1804599
💩💩💩💩💩💩💩💩💩💩
 
@ThePhD a stack of shit, interesting; is there also a queue of shit?
 
Watch it as soon as you can, because it discusses topics relevant everywhere.
Including outside of programming.
 
2:55 PM
what does it even mean, "things outside of programming"
 
Just watch the talk. :P
 
Things like going to the toilet I guess.
 
user1804599
@ScarletAmaranth that's a toilet
 
user1804599
Flush the queue!
 
@Morwenn this seems to be somewhat consistent with "real world is where my pizza guy comes from"
@rightfold how about a deque of shit then?
 
user1804599
2:57 PM
@ScarletAmaranth Chandler hates deques and Chandler is God so deques don't exist
 
> Building and Extending the Iterator Hierarchy in a Modern, Multicore World
Sounds like I've found something to read :D
 
user1804599
Lol C++ iterators
 
user1804599
Throw them out of the window and clone Rust iterators
 
Patrick's approach is really good though.
lol rust
 
lol rightfold « lol » opinions on things
 
3:00 PM
@ScarletAmaranth it means psychology and politics
 
user1804599
If you think C++ iterators are well-designed then you're not mentally capable of evaluation.
 
user1804599
IOW a moron
 
I'm fine with being mentally retarded, thanks.
 
@ScarletAmaranth Before you boot and after you shut down your computer.
 
@fredoverflow TIL things outside of programming happen once a week
 
3:05 PM
@rightfold does Rust even have iterators other than input?
 
Ell
@Morwenn oooh
that sounds interesting
@Griwes I started watching it last night
I became disinterested after half an hour
 
...watch it dude
 
Ell
meh
too late now
it missed its chance
 
@Griwes What's next? Talking to C++ programmers about Haskell? ;)
 
@Ell ...
 
Ell
3:18 PM
it had half an hour to engage me
but failed
 
yeah the talk has gone to shit really quickly
 
probably when he started talking about where he's from
 
@Ell the summary of the useful content from the part you missed: talk about turning runtime errors into compile-time errors, don't talk about vectors and strings.
 
so he's missed nothing
 
3:23 PM
I thought the imporant part was "Stop arguing" or something.
 
Ell
^yeah
> if you're arguing you've already lost
but I would expect the compile time error to be the most useful for c programmers
 
3:47 PM
I watched the whole talk.
 
3:59 PM
@ThePhD you clearly have too much time on your hands
 
user1804599
@Cubbi The superior equivalent of output iterators is called extend.
 
4:17 PM
Kek (at your face)
 
user1804599
lol talking to C programmers
lol talking about C++
 
user1804599
kek indeed
 
user1804599
kekkekkek
 
user1804599
consumingKey :: forall a. Action a -> Action (Maybe a)
consumingKey action =
  readInventory Key >>> case _ of
    0 -> Nothing <$ log "You need a key to do that."
    n -> writeInventory Key (n - 1) *> (Just <$> action)
 
user1804599
super rad
 
4:27 PM
fucking EA
max password length 16 characters
 
user1804599
XD
 
serves me right for thinking I might want to play a game made by them
 
Ell
which game?
 
maybe BF3
 
5:02 PM
@Puppy Why limit the size of passwords? Aren't they stored as fixed-size hashes, anyway?
 
good question
 
@iksemyonov waaaat
 
user1804599
5:26 PM
@fredoverflow No, they're stored in CHARACTER VARYING(16).
 
user1804599
Well, tbh, some max length for passwords is a good idea.
 
user1804599
If it's unconstrained then a user could quickly DoS your server by submitting a huge-ass password.
 
user1804599
Like, a terabyte.
 
nwp
have fun uploading a terabyte
 
@rightfold You can avoid that with a standard request size limit.
doesn't need to involve password-specific limits
 
5:42 PM
at least they should set it to a reasonable password length amount, such as 1million characters
 
user1804599
 
Ven
6:42 PM
@rightfold RIP your avatar
 
posted on September 25, 2016 by Herb Sutter

After my talk on Friday, a couple of people asked me how I was storing destructors in my gcpp library. Since several people are interested, I thought I’d write a note. The short answer is to store two raw pointers, one to the object and one to a type-erased destructor function that’s handy to write […]

 
all standard smart pointers do (auto_ptr is not smart)
 
I'm thinking about starting a project
 
Narrow?
Had sensible chuckle
 
they have hands bigger than his?
 
7:00 PM
0
Q: Why std:: command format used so much on this site?

James NimmoI am relatively new to C++ coding, so please be nice to me. Why do so many of you use the format std:: command format for example: std::cout instead of just cout ? If one uses using namespace std; Doesn't this statement eliminate the need for std:: command format or is this just forc...

 
@Feeds lol
 
This might be a better question for meta. — NonCreature0714 3 mins ago
 
oh my the specialhatred fast
 
@Feeds and now it's deleted!
:D
perish, foul question
 
7:09 PM
not to be confused with fowl questions
 
@sehe Page Not Found :/
 
Well. That's super duper deleted
 
Already 35% of the crowdfunding achieved for our album :D
 
what, you can't access it either @sehe?
 
And we didn't even share the link on our Facebook page yet.
 
7:10 PM
noice!
 
So noice :p
 
user1804599
@Ven I like this one, and it fits my rep
 
@jaggedSpire I can
@Morwenn fuckers
Have they no patience
 
user1804599
Give crisps
 
@sehe oh, okay then. When you said it was super deleted I started wondering
 
Ven
7:16 PM
@rightfold your rep as?
 
user1804599
@Ven my 18k rep
 
Ven
ah
 
Ell
I just realised
Eric Niebler is Stepanov 2.0
 
He's Stepanov's legacy.
 
Xeo
@Ell Stepano v2
 
they're also very good friends
 
@Morwenn Suici.De.pression -- That does not sound too inviting to listen to it. :)
 
8:25 PM
@wilx Well, it is depressive suicidal black metal.
The sound is a bit close to atmospheric black metal.
There's a strong melancholic feel to the genre, but I wouldn't call it depressive, nor suicidal :p
But you know how it is: when you make metal music, you have to be extreme :D
 
Ell
I don't like extreme metal
 
I don't like metal.
 
@Ell I like some things considered extreme metal (some subgenres of death and black), but definitely not everything.
 
Ell
I like Queens of the Stone Age
 
I can't say I'm fond of them.
 
Ell
8:31 PM
era vulgaris at least
I've only listened to that album
 
8:53 PM
I was reading an article about dedicated biological computers made out of silicon and rabbit to solve specific problems.
It looked kind of fun.
 
Ell
night all
 
Ven
@Morwenn enjoyaable
 
@Ell Night :)
@Ven Eh, glad you like it ^_^
 
Ven
It's not like I crave screams but it's no too bad
 
9:06 PM
@Morwenn it's pretty good - also not really depressive; I consider most of Depeche Mode stuff a lot more depressive
 
9:16 PM
@Ven what? You don't crave screams? What do you use to lull you to sleep at night, then?
 
@Ven It took me time to get used to screams, but I now like them more than some kinds of growl.
 
@wilx You need iron to live, biatch
 
@ScarletAmaranth The voice of their singer is often one of the reasons.
@jaggedSpire Haha, that reminds me of a C&H episode :D
 
user1804599
9:25 PM
@sehe you love this: youtube.com/watch?v=W7mQb01R-fE
 
A wild Vektroid album appeared ♥
 
10:08 PM
how? the textual compilation would have been... funny.
That whole over the top misinterpreting misses the mark IMO (it's trying to "make" something funny that already /was/)
@Morwenn Or you recall the link I sent the other day
 
I'm about to sleep ><
 
Don't fall asleep now
that would be a waste of time
 
@ScarletAmaranth Depeche Mode, that's a band I haven't listened to since people are people.
Google tells me that was in 1984 !=)
@sehe Bluesette sounds like weaponized neat.
Fantastic stuff.
 
10:36 PM
user image
5
 
probably Stephen Colbert
 
Its not goering in the riech direction
 
11:10 PM
@Mysticial sorry if i pulled you away from work, i've solved most of it myself already (i'm speeding smth up with sse)
 
@iksemyonov lolno, it was the middle of the night for me.
 
@Mysticial but how'd you go about optimizing this: alpha_int *= (1 - alpha); where both vars are float? the profiler insists there is a bottleneck
i mean, it might "stick" like you know execution time sometimes sticks form another instruction in VTune, but this code is pretty much alone, nothing to stick to it
 
that looks like an FMA to me
 
alpha_int = -alpha_int * alpha + alpha_int (negative multiply add)
 
not sure if there's an equivalent for subtraction
 
11:13 PM
@Puppy well there is no vector here that's the trick
and i have no fma right now, it's a westmere
 
@Mysticial Shouldn't that be alpha_int = alpha_int - (alpha * alpha_int)?
 
@Puppy Isn't that what I wrote?
 
don't think so
that -alpha_int term looks miiighty suspicious to me
 
It's the same thing, I just put the negative term first.
 
doesn't that require brackets?
 
11:17 PM
however.. hmm. may i post a screenshot of vtune? maybe it's a store that "sticks" to the said float operation
 
no, wait, that is the same either way
I'm just gonna FOTB now
 
Does C++17 mandatory RVO mean that the address of the return value is in the scope of the caller? IOW, is it safe to take the address of the value to be returned and use it after leaving the scope of the function?
 
Are you asking if its "okay" to return a pointer to a local variable?
 
I have a use-case where I'm trying to pass the value to be returned into a lambda by reference (and then a separate thread) that will outlive the callee. But will finish before the caller finishes.
@Mikhail Correct. If the local value is the value to be returned.
 
imgur.com/a/IHNva here you go gentlemen, the line is highlighted. weird to me how the mul/sub aren't taking all the time but instead some movssl is
 
11:23 PM
My use-case is this:
WaitHandle async_load(void* T, size_t offset, size_t L){
    WaitHandle handle;
    std::thread thread([=, &handle]{
        load(T, offset, L);
        handle.signal();
    });
    return handle;
}
^^ That is illegal up through C++14. Does C++17 mandatory RVO make that legal.
 
no
mandatory elision will involve prvalues
 
dammit
 
there are tricks around that tbh
 
Like using a future , std::async, or producer consumer queue?
 
@LucDanton The only two things I can think of is to put WaitHandle in the caller scope and pass it in by reference. Or wrap it in a unique_ptr, but that means an extra allocation. WaitHandle is a brick object since it holds a mutex and condition variable.
I'm leaning towards the second option.
Since I'm dealing with locks here, the extra memory allocation probably isn't going to matter.
 
11:27 PM
I may have spoken too soon re: tricks, prvalue is a (relatively) high bar to set now that I think about it
 
Can't you just call std::async like normal people? Then wait on it?
 
@Mikhail No. Right now, I'm using std::thread, but later on it's going into a custom framework.
@LucDanton Actually, WTH is a prvalue anyway? The first time I've seen it was looking at the mandatory RVO proposal.
 
@Mysticial in a WaitHandle constructor *this would refer to the object to be
 
Just auto wait_on_me = std::async(std::launch::async,load,this,...); wait_on_me.wait(); ... If you get messed up by thread pooling you can try to use a second thread that receives work events (this is what I typically do)...
 
@Mysticial expressions like 0 or nullptr or std::vector<int> {}
 
11:31 PM
@LucDanton ah
@Mikhail Wait what?
 
@Mysticial you can do this today btw
 
Oh, you mean construct it on the return expression?
 
yeah
for non-movable types obviously no move is involved
for movable types I actually don’t know though (pre-C++1z, that is)
yeah even in C++1z you don’t want to do that with movable types if I’m reading this right
> When an object of class type X is passed to or returned from a function, […], and X has at least one non-deleted copy or move constructor, implementations are permitted to create a temporary object to hold the function parameter or result object.
emphasis mine
 
Wait, doesn't that contradict the mandatory RVO?
 
that’s me being conservative though, I don’t understand all that stuff
@Mysticial I don’t get it either
 
11:40 PM
lol
 
> Note: A return statement can involve an invocation of a constructor to perform a copy or move of the operand if it is not a prvalue or if its type differs from the return type of the function.
what is 'it' in "if it is not a prvalue […]"
again with the sloppy wording, although at least it’s in a note
 
The different return type makes sense.
 
it should be about the operand
@Mysticial I’m relatively confident that the previous is for the foo_type foo; return foo; case (i.e.: still not mandatory)
return prvalue_expr; is going to be a-okay no matter what
 
The problem is that I can't make it a prvalue.
 
if you control the type I suggest the constructor
bonus: it works in C++14 as long as the type is not movable
if it is, you can jump into hoops to make it work for you
 
11:46 PM
I guess I could if I just make the type take a lamda.
 
the difference between C++14 and C++1z is that you can get rid of the non_movable hoop
 
Either way, if the object is a brick and lacks a copy-constructor, it will either work, or it will fail to compile.
 

« first day (2171 days earlier)      last day (2770 days later) »