« first day (2121 days earlier)      last day (2830 days later) » 

2:06 PM
@milleniumbug Someone redid the SC1 campaign in SC2, I think.
 
Xeo
2:46 PM
4 messages moved to bin
Don't do that.
 
lol mysql_real_connect
 
Ven
@Xeo yknow we now have #anime on discord. :P
 
What else should I use ?
instead of MySQL_real_connect
 
mysql_unreal_connect
:D
 
nwp
@Sumatrin not what else, where else. Pick a site that answers questions such as this one.
 
2:56 PM
@R.MartinhoFernandes Isn't it mysql_real_escape_string or something as well?
 
@Puppy PHP function IIRC
 
@Shoe The PHP functions wrap the C functions. The C connector has an actual mysql_real_escape_string function.
 
hey bois
got a question
let's say i have
struct A {
int a;
};

struct B : A {
int b;
};

A* a;

a = new B();
could i access a->b?
 
nwp
3:12 PM
@ChemiCalChems y u no click the fixed font button?
 
@nwp ?
 
No, because that static type of a is A*. You could always legally static_cast the pointer, however.
 
oh, i see
thanks
 
nwp
@ChemiCalChems edit the code line and click "fixed font" next to "send" and "upload"
 
can't edit now, will remember next time
@EtiennedeMartel so what would i do?
 
3:15 PM
First off, why not just use a B*?
 
@EtiennedeMartel because A is a base type for more than just B, and i don't know what it's gonna be until i run code which is in another scope
 
Otherwise, if you're really sure that a is really a B, then static_cast<B*>(a) works. But if it isn't a B you end up with undefined behavior.
Altenatively put some virtual stuff in there and use polymorphism.
 
@EtiennedeMartel i have already
 
Ell
@ChemiCalChems then why must you cast to B*?
 
@Ell to be able to access members that only exist in B
that's my reasoning, maybe it's wrong though
 
3:18 PM
std::map<int, const char*> m { {0,"zero"}, {1,"one"}, {2,"two"} };
std::array<std::pair<int, const char*>, 3> m { {0,"zero"}, {1,"one"}, {2,"two"} };

Anyone knows why the first works but the second one doesn't :<
 
Ell
@ChemiCalChems I think I need a bit more context really
 
@Ell i have an Instruction base type, with some more children types
AttackInstruction is an example
i parse some user input and decide where the instruction should be attack or another instruction
 
@Phantom std::array requires double braces.
 
Ell
If you are writing something against A's interface, you shouldn't access B's members. Alternatively, if you don't know whether or not you will be receiving a B, then you can't safely access B's members. If you do know you're working with a B, then you should take a B*.
 
since i do the parsing in another scope, i can't create an AttackInstruction object from there
 
Ell
3:21 PM
What do you mean, in another scope?
 
in another function that's called inside the function we are in
 
@Griwes Thanks for that. Do you happen to have a link explaining that? :D
 
Ell
you can do something like std::unique_ptr<instruction> parse_instruction(std::string encoded_instruction);
@ChemiCalChems That doesn't stop you from creating an object elsewhere :)
 
@Ell how so?
 
@Phantom std::array is an aggregate, literally struct array { T foo[N]; };; the outer set of braces is needed for the class itself, the inner - for the C array inside.
 
Ell
3:23 PM
@ChemiCalChems well, you can just have a function returning an instruction like the signature above
 
@Ell but the function may or not return AttackInstruction, since it has to decide whether the user input is of an attack instruction or not
 
Ell
@ChemiCalChems right, it returns a std::unique_ptr<instruction>
you can then tell the instruction to do things
my_instruction->do_work()
or whatever
 
shit, that's right
if the pointer is not nullptr, do it's stuff
 
@Griwes Thanks you very much for the explanation.
 
the problem, @Ell, is that i not only use the parsing function for instructions, but also to decide what the instruction target is gonna be
the code is a mess
well, it works, but the architecture may not be right
i could return a variant
either an instruction target or an instruction
 
Ell
3:40 PM
@ChemiCalChems Or you could make the instruction carry the target with it
 
@Ell that's what i do
 
Ell
@ChemiCalChems well, then the parse function can still only return instructions because that will have the target associated with it
 
wait
i could make it a template
@Ell that wouldnt work since the way it works is it parses one keyword at a time and returns
that's how i made it, which is possible shit
but anyway, i'd still be returning an Instruction, which wouldn't allow me to access AttackInstruction members either
so we are back to the same thing, only one scope up
is there no way of casting a base class into a child class forever?
 
reinterpret_cast lolol
 
@ChemiCalChems What do you mean, "forever"?
If you create an object of a type, it's always going to have that type.
 
3:50 PM
@EtiennedeMartel yeah
i'm gonna go the cheap way
set a flag via lambda capture list to that we know what to do with the info
which wouldn't fucking solve the problem at all
 
Ell
@ChemiCalChems what function will be accessing the members of AttackInstruction?
 
@Ell Why unique ptr?
 
@Ell a function at the target, maybe handleInstruction
it'll do what ever the instruction says
 
it's polymorphic
 
Oh, I see
 
3:53 PM
true, why the fuck am i holding the target inside the instruction when i'm gonna send it anyway?
 
Ell
@ChemiCalChems that should be inside the instruction base class
only each derived instruction type knows how to "handle" itsself
 
but the instruction doesn't have to handle itself, the target does
you don't give an instruction an instruction, you give somebody an instruction
 
Ell
Just to get some context
is instruction something that represents an instruction for a unit in an RTS game for example?
 
exactly
it's an rts, and it's an instruction for a unit
 
Ell
right
 
3:58 PM
how did you know?
 
Ell
and does each unit support different types of instructions?
 
@Ell yes
 
Ell
@ChemiCalChems just gathered it vOv
@ChemiCalChems so, here is sort of a problem
well.
let me think for a minute, it sounds like you need double dispatch
but not sure
 
ok google
 
Ell
does the attack instruction do the same thing to all units that support it?
 
4:00 PM
@Ell yes
 
Ell
okay let me write something on coliru for you
 
@Ell thanks
 
Ell
I'm struggling for examples, what other instructions might you have?
builds
that'll do
 
@Ell MoveToPositionInstruction
 
Ell
4:15 PM
eh I'm having difficulty
 
@Ell that makes two of us
 
I think CLion is ready for serious use now
 
@milleniumbug wasn't it before?
 
Ell
@ChemiCalChems you will necessarily have to have dynamic_casts or some such
 
@Ell i don't think that's a problem
 
Ell
4:22 PM
I'm just wondering where it will go
 
@Ell Why?
 
Ell
@Puppy How do you know what type of unit has the user selected?
 
the better question is, why do you care what type of unit the user has selected?
 
Ell
So you know which operations it can be instructed to do
 
4:24 PM
exactly
 
in pretty much all RTSes, all units can be instructed to do all things, pretty much
 
@Puppy yes, but not at the same time
 
well, actually, pretty much at the same time.
 
if i instruct something to move, i don't want it to attack
 
Ell
@Puppy Factories can't attack
 
4:25 PM
e.g. consider selecting a large group of units
 
Ell
factories can't move
 
then issuing the attack instruction.
@Ell That doesn't mean they can't be instructed to move.
it just means that they don't really do anything in response.
 
@Puppy exactly, you issue an AttackInstruction, not a MoveInstruction
 
@ChemiCalChems Yes, but you're basically issuing the attackinstruction to every unit the user has selected
 
@Puppy yes
 
4:26 PM
even though only some of them are actually going to be able to support it.
since the user could select a tank unit and a factory at the same time.
I think that realistically, you can order a factory to move.
it just doesn't do anything.
 
@Puppy if you are stupid...
 
nah
 
that still doesn't solve the problem
 
there's a big difference between an impossible operation and an operation that simply doesn't retuan a useful result.
 
Ell
@Puppy okay fair enough
 
4:27 PM
@ChemiCalChems Sure it does.
you don't give a shit what types of units the user has selected.
 
no no no
 
because they can all be ordered to attack
 
that's not the problem
 
or move
 
the problem is returning a specific instruction object from one generic function
that was the problem at the start
don't know how it morphed into something else
 
4:28 PM
that.. sounds like a trivial application of an interface.
 
@Puppy well, not trivial enough for me
 
Ell
@ChemiCalChems basically you need a unit base class with virtual void attack(unit target) {}, virtual void move(position pos) {}
you need your units to inherit from this and override the function when it is meaningful
 
@Ell so dump the Instruction object completely?
that would make sense
 
Hello, World!
 
Ell
then you need an instruction base class with virtual void instruct(unit& instructee)
 
4:32 PM
i've just had an idea
 
Ell
struct attack_instruction : instruction {
    virtual void instruct(unit& instructee) { instructee.attack(target); }
}
or something like that
and give it a target member
 
that just looks like a std::function to me.
 
Ell
yeah I agree
 
@Puppy i'm using lambdas in another way at the moment
 
Ell
^confusion see :V
 
4:34 PM
i'm going to implement my idea
 
also it would be better if the unit did not need derived classes.
 
it has to work
 
e.g. structure? just set move speed to 0.
unarmed? just have an empty array of weapons
 
Ell
meh
I don't like that
but it is a simpler solution
here is where dynamic typing would be useful
 
well
it much more readily permits surprising things
 
4:36 PM
i had an idea
 
e.g. in Starcraft, you can have structures, but you can push a button so they can fly around.
 
Ell
that's true
 
or things that are unarmed, but can be upgraded to have weapons.
 
basically, call the target.move / whatever from the parser itself
it sucks, but it'll do the job
 
derived classes should not be just "The base class but with this member set to this value"
 
4:37 PM
@Puppy we agree there
 
another example is that you have a bit of a combinatoric explosion.
for instance you could have "unarmed structure", "unarmed unit", "armed structure", "armed unit", and then things just get worse if you add more things they can or cannot do.
 
Ell
Nah, you'd have can_attack or can_move
 
this is by far the hardest thing i've ever done i think
 
inb4 ECS
 
Ell
and class tank : public can_attack, can_move
 
4:39 PM
i'm starting to thing i'm stupid
 
inb4 Puppy's rant
 
the thing I am working on at work
 
Ell
@milleniumbug yeah ECS is what you want
I don't like the impls of ECS that I've seen in c++ though so far
 
involves interprocess state synchronization, complete with various bits of state needing various degrees of consistency, and availability/partition tolerance too.
that's tricky.
 
see? i'm stupid
 
4:40 PM
with four processes at a time, each unique.
 
Ell
@ChemiCalChems nah you're not
 
@Ell compared to a dog, yes i am
 
sup
 
it's a game of "Here's the simplest logic in the world; now figure out how the fuck to get the data"
 
one-liners are fun .. when it's not your job to debug the code
 
Ven
5:24 PM
:P
 
5:35 PM
What I did today so far: Woke up, received food order shipment, spent 3 hours creating a picture in Tikz, made lunch and ate it, spent some time reading up on domestic violence, took a nap, woke up.
 
What I did today so far: Woke up, made breakfast, eat breakfast, played fallout 4 for 3 hours, watched anime for 2 hours, made lunch, eat lunch, played fallout 4 for 2 hours, watched a movie, took a nap, made lemonade, watched anime for 30 minutes, and has been staring at the chat box for 10 minutes now..
 
:D
@Khaled.K OK, I feel better now. Thank you. :D
 
I think it's time I go make dinner.. so, later
 
@Khaled.K wow that's a productive day
What I did today so far: woke up, ate breakfast, browsed the lounge, discord lounge, and stuff, browsed 9gag, made laundry, chatted a bit in the discord lounge, played a bit of Brutal Doom, complained about the state of programming languages and IDEs
 
@milleniumbug Oh, I forgot I did laundry as well.
 
5:52 PM
when you were doing awesome until suddenly you run into memory problems and you want to quit
oh fucking well
 
6:14 PM
that's the price you pay for working in C++
 
@Puppy Memory problems? You get that in say Java as well.
 
depends on the nature
you typically can't start corrupting random memory
 
I’ve never had memory problems, or at least none that I can remember
19
 
@LucDanton :D
 
I've only had them on rare occassion, mostly when an outside API doesn't handle it properly like LLVM
 
6:26 PM
in this case, it's me
is it safe to ~unique_ptr?
that might be all of my problems
 
nwp
@ChemiCalChems why would you ever do such a thing?
 
@nwp i don't know
i'm starting to question my c++ knowledge
 
lol don't be a badlet
 
it's much better to erase it from the vector and that's it right?
 
oh wait you already were a badlet
 
6:35 PM
i think i'm getting it
got it
no errors anymore
it had nothing to do with ~unique_ptr
but i'm changing that anyway
 
Performance of signed vs unsigned: compare_with_constant vs divide_by_constant. Probably doesn't matter much in real applications, but I need this stuff in order to retain my guru status among colleagues :P
 
@StackedCrooked interesting
@milleniumbug just curious, what's a badlet?
 
I was inspired by two posts.
 
compare_with_constant: The int comparison never overflows so it is obviously true. The unsigned comparison needs to be checked because it might be a case of overflow.
 
yep
In the land of the blind, the one-eyed man is king. At my workplace, I'm that king.
 
6:49 PM
:)
 
Ven
@StackedCrooked it's pretty obvious why.
 
The previous king had a really blunt ey e.
 
Ven
Signed overflow is UB, so the compiler doesn't care. Unsigned overflow is defined, so the compiler needs to care
 
@Ven In hindsight I agree. It would never have considered this without the blog posts thought.
 
divide_by_constant: The unsigned case is easy. The int case has to account for the signature of the result but I do not directly see what it is doing.
 
Ven
6:52 PM
Makes sense
 
Yeah, the assembly is mixed with the code for parameter/return value handling.
> Division by powers of 2 is faster with unsigned int, because it can be optimized into a single shift instruction. With signed int, it usually requires more machine instructions, because division rounds towards zero, but shifting to the right rounds down.
Oh, it's by @fredoverflow :P
 
7:05 PM
@StackedCrooked Huh...
Is there an optimization level at which the compiler will generate exactly the same code?
Hmm I guess it cant?
 
No the optimizations are made possible due to differences in the binary representation of signed vs unsigned numbers.
And undefined-ness of signed integer overflow.
 
ah
so what youre saying is, if i care about performance, i should use signed integers? :P
 
@Borgleader depends on the operation
 
ffs, i want easy rules of thumb for performance #gamedev #prematureoptimization #sqrt(all_evil)
 
Ven
@Borgleader i explained why a bit earlier ye
 
7:20 PM
Unsigned integers can never be negative. Use them for your bank account.
@Borgleader Performance should not be the deciding factor.
You should pick the one that makes most sense.
 
@Ven why is the unsigned divide faster then?
@StackedCrooked But my CPU cycles :(
 
@Borgleader Btw, that one only works if the constant is a power of two.
@Borgleader The CPU spends most of its time waiting for memory. So you're doing it a service by giving it some extra work.
 
What if I'm ALU bound?
what if
 
What.
 
Then get more ALU.
 
7:24 PM
How do I even begin.
 
I did it
 
@ThePhD hey sexy thang
 
I drew a square in OpenGL
6
 
@Borgleader Heey handsome. <3
 
Xeo
> AActor
uh-oh
 
7:25 PM
@ThePhD That capture by reference looks risky.
 
Xeo
I smell Unreal
 
@Xeo Nah OpenGL
 
Ven
@ThePhD std::alligator
 
I'm trying to figure out what's the goal here.
 
@ThePhD allacators, TThink, AActor, wut?
 
7:25 PM
And I can't figure it out exactly.
I think they want to save the Iterator state,
 
Xeo
@StackedCrooked Not just looks, but is provably wroooong.
 
and then call Next on it?
 
Xeo
Should capture by-value in a mutable lambda then?
 
@Xeo ah, didn't even see it was a local variable.
 
@Borgleader antialiased actor
 
Ven
7:26 PM
Well you can call it a first time
And you get an iterator
Then you call that iterator as many times as you want to next it..;o
 
I sometimes store references to local variables. So when they pass away I still have something to remember them by.
int i used to live here, sniff.
 
Xeo
And then they kill you from the grave.
Lovely little bastards.
 
literally zombies
 
it's home is now occupied by this asshole float guy
 
Xeo
7:30 PM
Sounds like some kinda comedy show
"Local Zombies"
 
Ven
romero -O2
 
Started watching Momokuri two weeks ago. Most stupid anime ever. Still watching it.
Yah, new shokugeki today.
 
Hallo
It's been quite a while o-o
How's everyeone
How's everyeone
 
7:48 PM
The new graphs in the new Wireshark are really helpful in diagnosing TCP problems. (This one beautifully shows NewReno performing loss recovery.)
 
8:00 PM
Aug 3 at 12:09, by Luc Danton
repro, since it’s a regression I’m hoping it’ll get fixed fast-ish
tagging as a regression worked!
 
Ven
Gg :)
Un petit pas pour l'homme, un gros pas danton luc
 
le truc c’est d’utiliser des bottes
 
8:24 PM
these past couple of days
I've written some questionable sea pee pee
latest is my unironic use of delete this;
 
:O
...can I ask?
 
@jaggedSpire yes
 
cURL only gives me a single private pointer to use so I have to consolidate all my async context into that one private pointer
and since I dynamically allocate the context I need it to clean itself up when cURL tells me it's ok to clean up my handles.
 
@Borgleader but wlll he answer? oh okay
@Rapptz oh jeez
 
the lifetimes are weird
 
8:30 PM
> clean up my handles
 
yeah cURL invokes callbacks and tells me to check cleanup every time the callback is invoked
 
@milleniumbug TIL double entendres are a state of mind
that doesn't seem...pretty
 
disregarding the penis jokes
 
Hey @milleniumbug I've got another two hundred at thirty six questions for you to answer
 
good job at having this many questions
try googling first
 
8:40 PM
haha
I'll try to rtfm
They're all commonly asked questions
Hey there's a room called something like In rust we trust
@milleniumbug Do you ever hang out there
Or do you not trust in rust
 
I tried rusting a bit, but I don't really trust my rust skills
 
Your skills are rusty
 
9:08 PM
Yeah!
 
Ell
9:27 PM
Enough with the comics :3
They take up a lot of vertical space is all :P
 
Hello
 
But I wanted to spam more comics D:
 
And they're not even funny.
 
Oh come on now
I wrote them myself
 
"Kurwa" "ahaha"
 
9:34 PM
Now you're just hurting my feelings
What it's funny
You wanna argue about how funny it is?
I can argue with people on the internet
 
@EnnMichael Prove it, cuz I saw that last one a few days ago on reddit or something.
Actually nvm
I dont care
 
LOL
plagiarism
 
Nice.
@thephantomderp @EliasDaler BUT this iterator works perfectly in a few short lines, wow. quite an improvement https://t.co/TjmgRaKa1h
@Borgleader ^ That code save from the image.
Taking 50 lines and making it 5.
 
Nice indeed :)
 
@ThePhD :)
 
9:50 PM
The mobile Version of this Chat is kinda fucked
.. and my phone's capitalization settings, too, apparently
 

« first day (2121 days earlier)      last day (2830 days later) »