« first day (1686 days earlier)      last day (3267 days later) » 

10:00 PM
Anyways, do any of you have experience with Boost.Asio? And is it high performance?
 
I will make a custom css to search out for VermillionAzure and replace with Cinch
 
Damn, that's dedication
 
@StackedCrooked wait so calling a function like that through a template will prevent inlining? but making it into a lamba won't?
 
@Prismatic No why would you
 
TRIBUTE IS ON!
 
10:01 PM
It's all as-if rule
 
@milleniumbug why would I what
 
@Prismatic Don't trust the benchmark you haven't written yourself.
 
@Prismatic It will not always prevent inlining. I just meant to say that if it is not inlined then there's a bigger cost than just the pointer indirection.
 
@VermillionAzure it's pretty fast, why?
 
10:04 PM
@Prismatic You also need to pay for parameter setup for the calling convention (minor cost). And you miss out on optimizations opportunities like reordering.
 
@BenjaminGruenbaum I wanted to start playing around with a networking library
 
@VermillionAzure what do you actually want to do?
 
Boost is always a good choice for playing around
 
@BenjaminGruenbaum Not sure. How about a basic chat client?
I want to understand how some games do networking on the most basic level.
Or other programs.
Networking experience is invaluable.
 
dann
 
10:07 PM
Then why start with boost::asio? Do you really want to start with C++? This can be a lot easier with something like NodeJS, Go or Lua, there are solid python libraries too.
 
remind me how I get un-ancient packages with noobuntu?
their Boost only goes up to 1.55 and g++ only up to 4.8 :(
 
@BenjaminGruenbaum I've already done a small bit with Node.js
 
If you want "raw" you can use the glibc APIs directly or something.
 
Boost::Asio is C++, not C.
 
@VermillionAzure Asio is great. The more I learn about how it works the awesomer I find it.
 
10:08 PM
@VermillionAzure well, then you can do that.
 
Ell
@Puppy iirc there is a GCC ppa
 
@VermillionAzure yeah, I meant C++, it's boost it's obviously C++
 
@Puppy I had that problem recently. Solved it by installing Fedora.
 
@Puppy remove ubuntu and install arch
 
^
My life has been a lot happier since using Arch instead of Ubuntu, though I run neither on my dev box.
 
Ell
10:09 PM
But its pretty easy to build
 
@BenjaminGruenbaum But I've already done that.
 
@BenjaminGruenbaum If it was a C library then it would have been named boom.
 
I'm learning C++ simply because its what I choose.
@StackedCrooked No it would've been named "hop"
 
@ScarletAmaranth CSS is primitive
Annoying
a.user-16102 div.avatar::before {
    content: "BUTT WIZARD" !important;
}

a.user-16102 div.username {
    display: hidden !important;
}
Ugh doesn't work for expanded
 
@CatPlusPlus what
 
10:12 PM
No it would be called programmers-don't-need-feet-anyway.
 
@Puppy You can install gcc 5.1 with apt get (you just have to configure it to allow beta-test level packages). Offhand I don't recall how I installed boost.
 
cat is a butt wizard
 
with ubuntu don't you have to get special dev packages or something
 
@VermillionAzure if you want to learn how networking works I find that Go is really nifty for that- implementing fault tolerance protocols was really nice for me in it. That said - I'm not sure what you mean by learning networking - I can recommend "A top down approach" as a book and that contains good exercises (In Python, IIRC).
 
Needs jabbascript because snackchat figured it'd be a good idea to add inline styles to elements
 
10:13 PM
@Prismatic yeah I think but it's just an extra -dev
 
ah that's not too bad then
 
@BenjaminGruenbaum What I mean is learn high-performance networking and low-level abstraction binding to high-abstraction code with C++
 
@CatPlusPlus can you make a dark theme pls
 
I could choose C but I hate C. I cannot C why C.
 
"Performance" is a non-goal when you're learning basics
 
10:14 PM
@CatPlusPlus I could go learn Ruby on Rails....
But that's not what I'm here for.
 
@VermillionAzure I'd probably start with libuv and not boost::asio, it has a more solid book. I hate C too but it doesn't really matter. Also - I'd start with learning how networking works first and not how high performance networking is.
@VermillionAzure you could learn Rails and have no idea what TCP is
 
Networking has exactly the same performance characteristics in every language
 
You could even learn rails and not know what an HTTP status code is, lol.
 
@BenjaminGruenbaum Yup. Same for Express.
 
^ boost asio docs are ... actually better than most boost docs but still not that great
there's a chat example though iirc, which is what you want to do
 
10:15 PM
@Prismatic libuv docs are pretty good.
Although I agree with Cat, don't learn a library - learn how things actually work.
 
Yeah libuv has nice documentation. All written with like sphinx or something fancy
 
@Prismatic There are many examples actually.
 
Learn how TCP works, what fast retransmit is, learn what BGP is and so on.
 
If you want to learn async then it's better to pick an extremely high-level thing first, instead of libuv or whatever
 
Xeo
lolz. Taiga just jumped from my desk to the ceiling (which is 2.6m high) just to knock down (and then eat) a spider
 
10:16 PM
C# async/await or even something above that
 
@CatPlusPlus He said he already knows Node
 
Right
And I'm not a butt wizard
 
@Jefffrey Yeah. I didn't find examples lacking, I found the documentation on the API to be really terse though
 
Which I can easily disprove
 
@BenjaminGruenbaum Bah.
 
10:16 PM
@CatPlusPlus what is there above it?
 
@Xeo Damn I should get a cat
 
@BenjaminGruenbaum I said I played around with it and did a bit in it. I don't "know" node.
 
@VermillionAzure fast networking is mostly avoiding things that make it slow.
since you can't make the network faster with faster code.
 
@VermillionAzure well, you want to understand networking - go do the exercises in "a top down approach".
 
10:17 PM
@Xeo I should turn you in to the society for the prevention of cruelty to animals. Watching a vicious predator torturing and killing a poor, defenseless spider, then laughing about it. What kind of monster are you, anyway?
 
A cat monster
The best kind of
 
@VermillionAzure If you want to learn distributed systems I think implementing Raft could be a good start. The problem is distributed systems is more than networking.
@VermillionAzure if you want to learn how the internet works - also, "a top down approach".
 
@BenjaminGruenbaum You're a cruel man
 
spiders are freakish nightmare creatures that snuck into our universe from some kind of terror-dimension
 
Xeo
@JerryCoffin I catlover.
 
10:18 PM
If you really want fast networking then open the socket in promiscuous mode and take full control.
 
@StackedCrooked lol yeah that'll work best
 
If you just want to write fast servers, you can just learn NodeJS or go or C# ASP.NET or whatever.
 
A few years later you might make it work.
 
You're v likely to implement TCP better than your OS vendor
 
Xeo
I should start sticking fake spiders to the ceiling or something
just to entertain Taiga
 
10:19 PM
> open the socket in promiscuous mode
 
@CatPlusPlus I could (should?) have told him to start with communication avoiding parallel strassen :D That would have been tons of fun.
 
Also seriously stop saying "fast" it's dumb
 
sounds lewd
 
Xeo
Cause I'm kinda running out of real spiders in here.
 
Does your cat freak out with a laser pointer?
 
10:19 PM
If you want to write fast servers then write servers that don't do anything
 
@CatPlusPlus not better, but faster :P
 
@Xeo I guess that would explain your callous disregard for biodiversity and the general well-being of the planet.
 
@CatPlusPlus it's ok to misuse a term if everyone knows what you mean.
@CatPlusPlus does /dev/null support sharding? Is it web scale?
 
Networking is a special kind of I/O
 
Xeo
@Prismatic Follows it, but not all that crazy.
 
10:20 PM
@BenjaminGruenbaum Yes
 
@StackedCrooked You meant raw sockets?
 
Xeo
@JerryCoffin I liked the spiders in my home :<
 
@milleniumbug yep
 
Xeo
but y'know, survival of the fittest n everything
 
And gives more integrity guarantees than MongoDB
 
10:20 PM
Promiscuous mode is a different thing, I think
 
Shards are the secret ingredient in the web scale sauce. They just work.
 
@CatPlusPlus Yeah--and we all know what a demanding goal you've set there!
 
Promiscuous mode is when your interface stops ignoring packets not addressed to it
 
@milleniumbug It was named after puppy's mom
 
10:21 PM
Maybe I should just say that I'm going to use Boost.Asio and stop making like I'm not going to use it.
 
It's the thing you're interested in if you want to listen to WiFi network packets not directed to you
 
Fine then. I'm going to write a signaling server/client on my computer in C++ using Boost.Asio. Any tips or words for me?
 
Asio is not a good starting point for anything
 
@CatPlusPlus Linking wxWidgets wasn't either but I'm fine.
 
@VermillionAzure should be straightforward, if you run into any issues don't bother asking here - read the docs again and ask in main.
 
10:22 PM
Seriously use C# or Python or whatever
 
@CatPlusPlus I'm learning C++, not any other language right now.
I learn what I need to know and then my hobby language, C++
 
Unless you care more about learning minutiae of Asio rather than networking concepts
 
@VermillionAzure Don't write sucky code.
 
That has little to do with C++
 
@CatPlusPlus Other languages probably have standard libraries or packages to do this for them
 
10:23 PM
@VermillionAzure what do you mean with signaling server/client?
 
I know Java has one. C# too.
@StackedCrooked As in perhaps serialized byte data?
 
So? Every language ever has socket bindings
That's not the point
 
@CatPlusPlus The point is to do it in C++.
 
That's a dumb point
 
I could do this in Node.js but I want C++
 
10:24 PM
So do it in C++, geez, you don't need boost::asio for that, just epoll
 
@BenjaminGruenbaum what's "epoll"
 
Almost called that
 
@VermillionAzure I would consider sending data as POD over UDP.
 
But I decided it's self-evident
 
10:24 PM
@StackedCrooked Yeah, that sounds about right.
I guess I'll start with UDP or something.
 
I wouldn't even bother with endianness.
 
@StackedCrooked But that's testable.
 
UDP is not simpler
 
It's gonna be little-endian most of the time. If you have big-endian clients then they'll just have to convert it.
 
TCP much simpler than UDP
 
10:26 PM
You're not implementing UDP or TCP, you're implementing something on top of them, of course TCP Is a lot simpler to build on...
 
Network is big-endian bub
 
It takes care of a ton more stuff for you.
 
object1 = object2++ + object2; is not undefined behaviour, right?
 
It is
 
is
 
10:27 PM
But there's nothing dependent on the order of evaluation.
 
object2++ and object2
 
well, there is.
 
Ell
Puppy went through this the other day
 
not enough people listen to Puppy's wisdom
 
@Jefffrey how is this undefined?
isn't that post-fix?
 
10:28 PM
Because you have unsequenced access to modified thing blah blah
 
so it would be object1 = object2 + object2; ++object2; right?
 
it is both postfix and horribly undefined
 
It's postfix, but does ++ happen before or after the second reference is evaluated?
 
How so? object2 returns the old value, so whatever object2 is, objects2++ + object2 is actually objects2 * 2.
 
what's super dumb is that this is UB instead of just unspecified
@Jefffrey Nope.
 
10:28 PM
@Jefffrey noooo?
Because we can redefine operators
 
because the second object2 could be evaluated before or after the ++'s side effect.
 
@Puppy i thought post-fix always happens after the entire line
or statement
 
no
 
@Jefffrey Read it as operator+(operator++(object2), object2);
 
10:29 PM
it must have happened before the next line begins, but that's not the same thing.
 
@StackedCrooked and how is that undefined?
operator++ happens first, then operator+
 
No. There is no sequencing relation between the modification of object2 in object2++ and the reading of object2
 
@VermillionAzure Order of evaluation of the arguments is unspecified.
 
@VermillionAzure Because it's either object2 * 2 or object2 + (object2 + 1)
 
arguments are not evaluated left-to-right
 
10:30 PM
@VermillionAzure Actually the reverse is more likely.
 
@CatPlusPlus No, it's not.
 
Yes it is
You have no guarantees about order of evaluation of arguments
 
We're assuming that a * 2 == a + a
 
That's irrelevant
 
10:31 PM
I got bitten once with foo(p->bar(), p); // p is auto_ptr
 
Operator overloading I mean
 
@StackedCrooked IIRC GCC evaluates right-to-left, clang left-to-right ("in most cases", probably)
 
It's UB even without
 
@AndyProwl i see.
 
> The order of evaluation of arguments is unspecified. All side effects of argument expression evaluations take effect before the function is entered. The order of evaluation of the postfix expression and the argument expression list is unspecified.
 
10:31 PM
Okay i get it now
 
undebifned nehaviuour
 
cplusplus.txt
 
So we can get different behavior depending on L->R or R->L eval
is that right?
 
not just that
 
@VermillionAzure yes
 
10:32 PM
Compiler can do whatever with it
 
@VermillionAzure Who said there are only two
 
even i = i++ is UB
 
49
Q: In f(x), can x be evaluated before f?

PuppyI have a C++ program. This program does something like this: struct MyT {void memfunc(std::unique_ptr<MyT> arg);}; std::unique_ptr<MyT> obj = /* some init */; obj->memfunc(std::move(obj)); Is this guaranteed to be valid, or can I end up calling a member function on nullptr? Standard quotes app...

 
@AndyProwl sorry what.
 
@Puppy Yeah, I realized that embarrassingly late.
 
10:32 PM
@VermillionAzure the assignment to i and the side-effect of i++ are not sequenced, so it's UB
 
@VermillionAzure There are two modifications to the variable, without intervening sequence point
 
@Puppy nice
 
@AndyProwl ...?
 
I actually don't believe it is UB in C++11.
the assignment is sequenced before, I think.
 
usually operator++ is increment the object, return a copy
 
10:33 PM
it's definitely UB in C++03..
 
@VermillionAzure That's not relevant
We're at expression evaluation rules
 
@CatPlusPlus how is it not?
 
@Puppy i = ++i would be non-UB in C++11 and UB in C++03. Post-fix is UB for both
 
Implementation of the thing doesn't matter
It's UB before that even comes into play
 
it's just plain UB
 
10:34 PM
@CatPlusPlus but the right hand side is evaluated first anyways?
 
only the value computation
the side-effect is unsequenced
 
@AndyProwl on regular int?
 
yes
 
10:34 PM
@Puppy This seems like a case where even if it was defined behavior it could still be risky to trust the compiler doing the right thing.
 
!!!!
 
@StackedCrooked Yes, I eventually removed all instances of this occurring from my codebase.
 
cplusplus.txt
 
10:35 PM
remove all c++ from your codebases
 
in fact
 
All your codebase are belong to UB
 
The fuck?
 
@JohanLarsson Yes
 
I had fun trouble with an intermediate solution where memfunc was actually static.
but the compiler would still evaluate obj-> and de-reference the pointer.
 
10:36 PM
Oh i see now.
God that was a brainfart.
....
this wouldn't happen as easily in Lisp...
 
it doesn't happen as easily in practically every other language.
 
(setq a (+ 1 a))
there. problem solved. no ambiguity.
 
The problem is not ambiguity
Lisp implementation can also do undefined order of evaluation (dunno if CL allows it but in principle)
 
@Puppy Why? Sure it's UB. But the kernel will only kill your app if you actually try to read or write to the memory location. What was it trying to read/write?
 
@CatPlusPlus But in syntax it's pretty explicit in order
 
10:38 PM
Syntax is irrelevant
 
@StackedCrooked No idea, but it hurt just as badly.
 
@CatPlusPlus Syntax is a part of it.
The language can be in whatever form but syntax is its form and its package.
 
@VermillionAzure (fn a b c d e) which of the arguments for fn gets evaluated first?
 
object1 = object2++ + object2; parses unambiguously
 
@BenjaminGruenbaum Depends on the function.
 
10:39 PM
so I replaced it with T::memfunc(std::move(t));
 
Syntax has no bearing on semantics
@VermillionAzure No
 
From AutoLisp it's evaluated from left to right.
 
which is unambiguously safe.
 
So whenever there are two or more different results depending on the order of evaluation, then you have unspecified/undefined behaviour?
 
@Jefffrey Only for primitive ops and when the compiler actually has the freedom to do evaluation order fun
 
10:40 PM
@Jefffrey oooh! buzzword time: idempotency!!!
wooooooooooooooooooooooooooooooo
 
@VermillionAzure does it guarantee that? Do you know it's always the case or is it the case just when you observed it at some time?
 
@BenjaminGruenbaum It's part of the documentation.
 
@VermillionAzure that actually has nothing to do with it.
 
@Jefffrey Yes. This is also related to why we need make_unique.
 
@VermillionAzure Not relevant
 
10:40 PM
@CatPlusPlus of course because I'm Vermie
 
@StackedCrooked make_unique? Isn't that the factory method for std::unique_ptr?
 
I think I've listened a talk where they put that example up for order of evaluation.
And there were some controversies.
 
@VermillionAzure The point Cat was making is the fact it's lisp is irrelevant - it dpeends on how the language decides to actually use the syntax tree. It's an issue of semantics.
 
@StackedCrooked The reason is more exception-safety than UB-safety
 
10:41 PM
@Jefffrey Yup, the f(std::unique_ptr<Bar>(new Bar()), std::unique_ptr<Foo>(new Foo())) issue
 
And I think that the Clang guy that rightfold loves said something like "We are tempted to make the order of evaluation completely random".
 
Lots of languages have specified order of evaluation like JS and C#.
 
Charmender or something is the name of the guy.
 
Chandler
 
Chandler Carruth
 
10:42 PM
Carruth
 
Yes, that one.
 
Charizard
 
C handler
he was doomed
 
@milleniumbug Oh right.
 
@Jefffrey (just to clarify, that issue isn't about UB though, it's just about exception-safety / avoiding leaks)
 
10:43 PM
Oh god we had this discussion before.
 
Ell
I still don't understand the order of evaluation fiasco
 
But I can't remember in what case there would be a memory leak. Is that because new Bar() can be evaluated and then new Foo() is evaluated and it throws?
 
that would be the static order of initialization fiasco which is a separate but related matter and completely not a fiasco at all.
 
And new Bar() was not yet wrapped in a pointer?
 
yes
 
10:45 PM
That's because parentheses don't introduce sequence points
 
I find that still extremely hard to digest.
 
A common cause of crashing during program termination is logging inside the destructor of a global object. (Loggers are often implemented with meyers singleton, so they will be dead long before the global object gets destroyed.)
 
@Jefffrey no wonder
 
Solution: don't have global objects
 
I'd find it hard to digest if the technique (converting two operations to one atomic operation) wasn't extremely common in multithreaded programming.
 
10:46 PM
Solution: don't do cleanup on exit
_exit() erry day
 
Ell
@Puppy I did mean the order of evaluation
 
Today I had to debug a violation of ODR where the linker wasn't telling me I had two equally-named classes in different TUs
 
Like you would expect that in afn(afn(a), bfn(b)), the compiler would choose either afn(a) or bfn(b) but complete them atomically.
 
it was not nice
 
Ell
I just forgot it wasnt a "fiasco" :L
 
10:47 PM
that shit can't happen if you don't do something stupid really
 
well of course I did something stupid
 
@Jefffrey but it can actually do a, b, afn(a), bfn(b), afn(afn(a), bfn(b))
 
having two classes with the same name in two TUs is stupid
 
3 mins ago, by milleniumbug
That's because parentheses don't introduce sequence points
 
I just didn't realize it
 
10:48 PM
@milleniumbug Yeah, I got that.
Well, here they are not just parenthesis.
 
@AndyProwl It's perfectly fine if they're in an anonymous namespace.
 
They are function arguments as well.
 
@Puppy It's not a fiasco. Just replace std::string global; with auto global = new std::string() and you're good :P
 
@Puppy They weren't. Hence "stupid".
 
indeed
 
10:49 PM
oh, I get what you were saying
 
what I maen is that it's not the name clashing that's the problem here.
 
Like would you call std::plus(12, 34) parenthesis?
 
well yeah my statement wasn't precise enough
 
although that would be confusing.
 
I'd call your mom parenthesis
 
10:49 PM
Well, yeah, syntactically they are.
But when you think of parenthesis in C++ you think of (a + b) for example.
Not fn(...)
 
@StackedCrooked Also Valgrind false reports + ABI breakage + no better than Java
 
@CatPlusPlus That should be braket's mom
</bad_joke>
 
Ell
In puppys question with a->memfn(std::move(a))
 
Fuck dtors on exit
I loathe software that swaps back all of its memory just so it can free it on exit
 
Ell
I can't conceive of how memfnc would work without evaluating move(a)
 
10:50 PM
@milleniumbug Valgrind will report it as still reachable. Which is exactly our intention :P
 
@Ell It can't- the question is whether a->memfn is evaluated first, which would be perfectly safe.
 
@AndyProwl Have you submitted your virtual thingy proposal?
 
@Jefffrey I never got to the implementation
 
Yesterday I had this epiphany and suddenly got the whole rationale.
If you remember I wasn't convinced about it.
 
right
time for puppies to sleep in a super cute way
 
Ell
10:52 PM
@Puppy I can't understand that either - if move() is evaluated after, what does memfn operate on?
 
@Ell The previous value that a held prior to moving.
 
@Jefffrey without an implementation it's really difficult to get support, and also it's really difficult to propose something meaningful, at least for me - words are ok only up to a certain point
 
right
 
there are several things that aren't clear to me either, I'd need to see them working in practice
@Puppy night
 
Ell
@Puppy I see. Night anyway
 
10:54 PM
@Ell Do you really? Because I don't :/
 
Ell
@AndyProwl do you plan on attempting an implementation?
 
Are you claiming that a->memfn(std::move(a)) has the same problem?
 
By the way, I need a new font for code
 
@Ell "plan" is a strong word :D I wish I could find the time and I still hope I will, but it's not going to happen before summer for sure
 
10:55 PM
Oh wait.
 
Ell
@AndyProwl yeah
 
Is there a proposal for std::identity<T> (akin to boost::mpl::identity)?
 
Ell
I look forward to it whenever it is anyway
 
I would like that.
 
@Jefffrey you can see that as memfn(a.get(), std::move(a)), where the first argument is this
 
10:56 PM
It's because that's transformed to something like memfn(a, std::move(a))?
 
@Ell will let you know if there is any progress
 
Right.
 
Ell
Cheers :)
I might attempt to help but I'm sure I'd be useless :L
 
The thing is I couldn't probably give you advice or supervision because I'm no expert either. Puppy could but he's busy and hates the Committee anyway
 
Evening fellas
its that time of the day where I come spend some time in the Lounge
 
10:59 PM
Evening king
 
Excellent choice good sir
 
I see only talk of C++
ewwww
 
Bunch of nerds
 

« first day (1686 days earlier)      last day (3267 days later) »