« first day (1264 days earlier)      last day (3908 days later) » 

21:00
@Mysticial I found some old snippet of our code which not only did that, but also had a big fat comment above the class explaining that the constructor was private so that the class can only be instantiated by another friended class, and this is because the object has to be allocated on the heap because it calls delete this in the destructor. Apparently, someone put a lot of thought into it all
I just don't see why they did it.
Do something really dumb, and then go out of your way to make it as safe and clean as you possibly can... instead of simply not doing the dumb thing in the first place
@Mysticial =) I wonder if any compiler has that removed as built in idiot proofing? Maybe a warning or a rm -rf ~/?
@jalf lol
What possessed you!?
@jalf Holy shit...
Isn't that still UB?
When you delete the object. You double delete it.
well, come to think of it, I guess they jsut had a delete this, but it wasn't in the dtor
so it wasn't UB
just needlessly complicated and fragile
@jalf Still, I think calling delete this; in the destructor can never end well regardless of how the object was created.
21:05
@StackedCrooked yeah, see above :)
I'm now curious how implementations handle a delete this if it occurs in a superclass, when the subclass has dynamic resources.
delete this; (outside of destructor) is something that I've seen a few times.
then again, "needlessly complicated and fragile" pretty much summarizes the entire component I found it in
user1804599
That’s what she said. — rightfold 23 secs ago
user1804599
21:08
Okay.
Also what happens if this is a stack object?
user1804599
Extremely lame.
@CaptainGiraffe then you're screwed
@jalf Is that when we get to the unicorn part of the UB specs?
@jalf Forcing an object on the heap I figure is pretty common. Especially if the object is absolutely huge and is almost guaranteed to blow the stack (I have a few of those). But definitely not a delete this.
21:10
@Mysticial but having it call delete this doesn't force it to be on the heap. It just forces it to blow up horrifically if it's not on the heap
@jalf :)
(also, as far as I could tell, there was no actual reason why it should be on the heap. It's not a huge object or anything
@ScottW wassup stud
@ScottW guess what I'm drinking?
@presiuslitelsnoflek water
In my case, I don't actually try to enforce that the object is on the heap. (which probably isn't a good idea) But I didn't want to implement whatever fragile work-around to enforce it.
Placement new and the unique_ptr factory is the only safe way to make it. (and it also requires SIMD alignment)
21:12
@Jefffrey OLENJEE JUSUU~~
@Mysticial Why the need for placement new?
@presiuslitelsnoflek get high on vitamin C, baby
@CaptainGiraffe To put it in preallocated memory.
then again, actual rational design is not what I expect from that corner of our code base. The component can basically be summarized as "a server process which, other than some light bookkeeping, basically does one thing: if it crashes, it knocks down a whole range of other processes and ends all running sessions, logging out all our users (which... is kind of the exact opposite of what we want)
bbookkeeppiinngg
21:16
@presiuslitelsnoflek please use set remoteecho=off on your terminal.
IIRC, my largest object requires anywhere from 4k - 50k depending on the size of the SIMD vector and the other compilation options. Compiling for AVX or larger almost always blows up the stack.
*If I put it on the stack.
why'd you put 50k on the stack?
How solid are variadic functions in C++? Is there any reason to avoid them?
Xeo
Xeo
C-style variadic?
avoid like the plague
@StackedCrooked To benchmark and test it. And I blew up the stack. So I had to force even that to use the unique_ptr factory.
21:20
overload resolution avoids them like the plague. be like overload resolution.
@presiuslitelsnoflek fairly solid, if you keep them at room temperature. If it gets much hotter, they start melting
@Mysticial ah, I see
Is there another way of making variadic functions without C-variadic style?
I'm saying that because here I see the same method copy/pasted 11 times (not my code) with a different number of arguments
Xeo
Xeo
variadic templates?
template<typename... Args> void f(Args&&... args)
21:20
@presiuslitelsnoflek macros :P
Xeo
Xeo
or tuples?
Xeo
Xeo
tuples then
auto operator>>= (M&& m, F&& f)
Alright, thanks :)
21:21
wait what
Xeo
Xeo
boost::tuple
how is that possible?
Xeo
Xeo
@Jefffrey ew
that's just wrong
@presiuslitelsnoflek so you want to unify all those overloads as a single variadic function?
Xeo
Xeo
21:22
it's still wrong
the operator has the wrong precedence
why is it "wrong"?
@Xeo yeah, but how is it possible that it works?
oh that
Xeo
Xeo
@Jefffrey ?
@Jefffrey M >>= F
Xeo
Xeo
21:23
it's right-shift assign
@Jefffrey @Jefffrey?
@jalf I don't "want" to, I wanted to know if there was a valid reason on making 11 copies of the same function and not use a "smarter" approach.
@Xeo IIRC there are only a limited amount of operators that can be overloaded and >>= is not one of them
Xeo
Xeo
yes it is
@presiuslitelsnoflek C++03 were rough times.
21:23
@Jefffrey You can overload that.
@presiuslitelsnoflek Maybe it was the right approach.
@Jefffrey you can overload everything except sizeof, ., alignof, :: and ?:
probably missing something
@presiuslitelsnoflek Or ....maybe it was not :P
oh
does the STL use >>=?
@Rapptz Isn't ?: a fancy syntax for invoking operator bool?
21:25
<bitset>
Xeo
Xeo
@StackedCrooked wut
@StackedCrooked ?
were you talking about overloadable operators?
@Rapptz I'd love to overload ?:.
Xeo
Xeo
Btw, to highlight the precedence problem: guess how m >>= f >>= g is parsed
21:26
@StackedCrooked yes
@Scott We didn't do anything for april 1st this year :(
@Rapptz I see
@Xeo m >>= (f >>= g)
Xeo
Xeo
yes
because that's the logical choice for assignment ops
@presiuslitelsnoflek Yes we did.
tbf you can't do much about it in C++
21:28
that's not precedence
Xeo
Xeo
a theoretical =<< would have the right precedence... but doesn't exist
that's associativity
Xeo
Xeo
@Rapptz Right, sorry
I seem to mix those up a lot
@Mysticial What did you do? Last year we impersonated Jon Skeet
238
Q: Why can't my program compile under Windows 7 in French?

Lightness Races in OrbitI'm running Windows 7 French and I'm trying to compile this really basic program, but Visual Studio is being stubborn and refuses to comply. I also tried compiling it with both GCC 4.7 and Clang trunk on Coliru and I get more or less the same errors (output is below the code), though I think Coli...

21:29
oh god
> 238 upvotes
yeah, it's a shame
1190 rep
Xeo
Xeo
also, monads without do notation are kinda meh
that's what I make in a year
he could take preprocessor skills from pfultz2
@presiuslitelsnoflek Last year's was this:
207
Q: What is this smiley-with-beard expression: "<:]{%>"?

XeoI came across the following program, which compiles without errors or even warnings: int main(){ <:]{%>; // smile! } Live example. What does the program do, and what is that smiley-expression?

21:30
and make it work
Xeo
Xeo
@Mysticial it already has more votes... :(
auto scores = LINQ(from(student, students)
                   from(score, student.scores)
                   where(score > 90)
                   select(std::make_pair(student.last_name, score)));
@Xeo But yours will live on. :)
@Xeo at least it can't grow :)
I still think this is the most creative use of preprocessor syntactic sugar :v
Xeo
Xeo
21:33
It's pretty clever, especially since the from etc macros only expand inside the LINQ one
I thought c# didn't have macros.
@StackedCrooked, :)
that's C++
It's the same as do-notation, btw.
from(x, y) is x <- y
@Jefffrey owkey, sec
Xeo
Xeo
21:36
do student <- students
   score <- scores student
   guard $ score > 90
   return (lastName student, score)
looks like something you'd do in the list monad
Here I am, thinking I have a simple statement that should induce soccer level hooliganism. All I get is a helpful comment...
btw, ftl sucks
the syntax is weird because it tries to be too Haskell-like
Sometimes I feel like learning Perl or Lisp.
There's literally nothing interesting about Perl
@Rapptz That would be very different experiences.
I'm kinda thinking about Lisp too, though I still loathe the syntax
21:43
while ( <> ) print; is an interesting way of reducing code.
It's not interesting, it's just unreadable
Man up. Learn Malbolge.
Morocco found lots of oil and now so many US companies are investing here, looks like we're gonna get in serious troubles.
Yeah, they'll bring you democracy and freedum
Xeo
Xeo
Ew, ftl uses operator^ for monoids
21:45
@R.MartinhoFernandes "named after the eighth circle of hell in Dante's Inferno", yeah
Xeo
Xeo
Is that library based on the stuff on Functional C++ or something?
help me there's a snip -
@Xeo it also uses * for fmap I think
"There are two ways to conquer and enslave a nation, One is by the sword, the other is by debt"
21:49
Oh no it uses % for fmap
> In a restaurant recently, this woman was looking at something right next to the door and I couldn't get past her to walk out. I said "Pardon me", she barely glanced in my direction and moved a centimeter to the right of where she was. I shoved past her and walked out the door, I hate that I felt bad for pushing her into the rack of personalized keychains she was inspecting but fuck it all I needed to get out.
22:11
@Mysticial Yeah, I agree with the deletion of this post.
:15628631 Why do I feel like the first fact isn't advertised as much as the second? Deleting jerk :(
you either invent the big bang or you get the kids. you can't have both.
i was wondering if i can find a good game written in C++ on github, can't seem to find one
You'll find more engines than games on github although i remember some old star wars games being released on there
thanks, i don't even know where to start reading the code
i always try to find the main
What the fuck is with these SPN breaks
Also Game::getInstance() :lol:
i hate singletons
user2260218
Is an exe significantly more nonsensical to read than class files?
user2260218
I was just trying to figure out how to protect my Java code from other people reading it, but I can't figure out how...
22:30
Stop wasting your time
@CatPlusPlus how can we write a system that doesn't rely on singletons?
By not using singletons
4
@CatPlusPlus that's the problem
No, it's not a problem at all
You just don't use singletons
And there are no singletons in the system!
in the case of writing games, you often need to have one object that contains instances that are updated in the main loop, some objects in other parts need to access those
22:33
No, you don't.
The problem is that you can't design for shit hth
(Programming games is not special)
any tips that i can follow to design a proper code?
Fuck patterns
here we go again
22:36
dependency injection makes it more difficult, sometimes i need to create an object that needs another obeject which is not created yet
Then your dependencies are fucked up
Singletons don't emerge naturally, ever
@Rapptz thanks, reading..
tbh singletons are useless (he goes over why they're bad too)
I don't know why they use it so much in gamedev code
Because game devs are bad
> Get it from a Service Locator. So far, we’re assuming the global class is some regular concrete class like World. Another option is to define a class whose sole reason for being is to give global access to objects. This common pattern is called a Service Locator and gets its own chapter.
This book is bad too
Fuck patterns
22:41
@CatPlusPlus It's pretty decent
there are some bad things here and there though
but overall it's not bad
New here? Read The Law.
12
urgh my guts
@DeadMG I read that as "urgh my nuts"
@Rapptz You do!
;)
@EtiennedeMartel uurgh you putz
23:02
@AlexM. And now t-shirts -.-;
posted on April 02, 2014 by Eric Battalio

While I am not attending the Build conference myself, I did tune in for the keynote and bits and pieces of other live-streamed talks and look forward to catching many of the sessions over on Channel 9 once they are available. Here is what is happening...(read more)

Xeo
Xeo
@thecoshman new UHC!
23:25
meowing
@ScottW <3 <3 <3 <3
OpenTTD start is the best. I've sent an airplane across the map and it's been going for almost a year now
Everyone talking about design patterns is probably bad at design
Also why are you pinging me with this crap
Planes breaking down immediately after starting is great
Woah they managed to make two trips in one year

« first day (1264 days earlier)      last day (3908 days later) »