« first day (1644 days earlier)      last day (3287 days later) » 

3:06 PM
this is pretty badass
 
14% packet loss wtf
 
@LightningRacisinObrit on wifi?
 
Damn, I want to use struct hack in C++.
 
no you don't
 
Ven
3:11 PM
struct hack?
 
TIL about processor microcode updates
 
do it, void* ftw
 
struct hack has nothing to do with void*
 
@Ven struct Hack { T data; Hack* array[1]; }; Hack* p = malloc(sizeof(Hack) + sizeof(Hack*)*31);
 
@LightningRacisinObrit right, tell me about messing with pointers/memory
 
3:14 PM
Crag<Hack>
 
@milleniumbug doing something naughty?
 
@milleniumbug less *
 
@LightningRacisinObrit three years earlier, in this case :)
 
> Words are memes that can be pronounced.
 
Ven
3:15 PM
* array[1]?
 
That's a nice definition.
 
@R.MartinhoFernandes I'm having trouble coming up with similar definitions for the medium involved in /other/ memes then
 
@milleniumbug and that's C
pretty clearly UB in C++
 
3:18 PM
Damn, I can't find a question about what C++ has to say about struct hack.
I know, I'll malloc a buffer, and then memcpy stuff.
 
having a pointer outside of an object is UB
nuff said
 
But the arrays are objects, and malloc returns an array?
 
Shit. I lost a piece of my skewb :(
 
Xeo
ugh, my head hurts. How does one properly serialise AI state.
 
I was talking about the struct hack
 
3:20 PM
So I won't access it through the struct then.
I'll just use it to calculate the size.
 
why don't you template <size_t N> struct structhack { const size_t len = N; Hack data[N]; };
 
@Xeo by calling .serialize().
 
In our engine, we use a special relative_ptr type that is defined as a uint32_t offset to itself.
 
Because I need N to vary at runtime.
 
3:22 PM
@milleniumbug Then use ~N
 
std::vector obviously dude
 
Also, I don't want std::vector, as the size of N is constant during the lifetime of the object.
 
@milleniumbug Just reserve beforehand.
 
Xeo
@EtiennedeMartel my problem is my task queue, and what happens if you save the game, update the game (which may put totally different things in said task queue, i.e. AI changed), and then load that state
 
@milleniumbug so?
 
3:23 PM
4
Q: Portable emulation of flexible array member in C++?

milleniumbugI'm writing a skip list. What I have: template<typename T> struct SkipListNode { T data; SkipListNode* next[32]; }; The problem with this code is that it wastes space - it requires all nodes to contain 32 pointers. Especially considering that in typical list, half of the nodes will on...

 
@Xeo Hmmmmmm
 
vector is the right answer
wrap it if you want to enforce that the dimensions don't change
 
Xeo
Maybe I should rewrite how the AI works, but this seems fine so-far. Except for serialisation.
@LightningRacisinObrit const std::vector<T>
:D
 
Why do you need to serialize AI stuff?
 
Xeo
3:25 PM
(though elements also can't change, then. but that was never a requirement!)
 
it's gonna be a serial killer AI
 
Xeo
@EtiennedeMartel savegame
 
Why do you need to save AI stuff?
 
@milleniumbug Forget using a type for the nodes.
 
You want the AI engine to keep track of decisions made earlier?
 
3:25 PM
You don't actually need it anyway.
 
Xeo
because it's part of the game state?
 
It's completely internal.
 
Xeo
and stuff should behave the same after loading than it did if you didn't load
 
So you want to allow save scumming then.
 
Xeo
what
 
3:27 PM
move constructing a const vector from your load function is perfect for that
what's the problem
 
@EtiennedeMartel anticheating in single player games is useless anyway
 
Xeo
@EtiennedeMartel no we don't. the player won't have direct access to save / load functionality anyways - it's autosave + continue a single game, in the end. probably.
(maybe with multiple profiles outside of that. think BoI:R)
 
@Xeo If you save the game, shouldn't you just save the whole state?
 
Xeo
@EtiennedeMartel That's.. what I'm trying to do?
 
Why should AI stuff be any different?
 
Xeo
3:28 PM
My concern is source (and behaviour) changes after game updates
 
@R.MartinhoFernandes So, I'll create a buffer (e.g. with malloc). Then I'll use placement-new to create an object at the first byte (as it's suitably aligned for any type). Then I have a problem - I need to guarantee the pointers are also suitably aligned.
 
Xeo
serialisation and deserialisation within the same version of the game is not the problem.
 
@milleniumbug Use a prototype struct for that.
 
What I'm asking is this: why is AI state a special case?
 
struct alignment_extractor { T data; SkipListNode* next; }; and then offsetof on that. (i.e. don't ever create any object of that struct; use it only to steal the proper alignment info from the compiler)
 
3:30 PM
Just serialize the whole queue.
 
Xeo
7 mins ago, by Xeo
@EtiennedeMartel my problem is my task queue, and what happens if you save the game, update the game (which may put totally different things in said task queue, i.e. AI changed), and then load that state
@EtiennedeMartel can't serialise functions :P
 
@Xeo Sure you can.
Depends on the functions
 
@Xen so what you really want is to serialize a queue/
?
 
(And this is why you treat game code as data, gentlemen)
 
@R.MartinhoFernandes Nice. I'll write a self-answer based on that (unless somebody will be faster)
 
3:32 PM
@Xeo doesn't using scripting to drive game logic do that actually?
 
I was going to say - surprised you have to go so low-level
 
i.e. scripting languages
 
@AlexM. I bet my left ball there is no scripting.
If your list of possible AI actions are all predefined and can be looked up by some sort of ID, then you can just save the ID and related parameters.
 
TIL Etienne has balls
 
@sehe Musical compositions are memes that can be played?
 
3:41 PM
@LightningRacisinObrit I have two of them, in fact.
 
Lounge messages are memes that can be safely overlooked
 
drop the what
0
A: Edit text which printed on stdout from stdin in c/c++

Konstantin DedovI solved this problem in this way using malloc (use backspace, delete and arrows (left and right)): #include <stdio.h> #include <string.h> #include <conio.h> #include <malloc.h> #define _FOR_RUSSIAN #ifdef FOR_RUSSIAN #include <locale.h> #endif #define ENTER 13 #define ARROW 224 #define LEFT 7...

TIL "editing text" on the console "using malloc"
 
@EtiennedeMartel that can only mean one thing
you never lost a bet :O
 
I'm not a betting man.
 
3:46 PM
13 mins ago, by Etienne de Martel
@AlexM. I bet my left ball there is no scripting.
 
I guess you could solve all problems by direct memory access, new problems not withstanding
 
20 secs ago, by Etienne de Martel
I'm not a betting man.
Uh-huh.
 
but this "setlocale(LC_ALL, "Russian");" XD
 
> Total Download Size: 1271.93 MiB
Oh no, I guess I won't be able to get any work done while all this stuff downloads
 
#define FOR_RUSSIA
 
3:48 PM
"cyka blyat"
 
@jalf For helvede!
 
#define FOR_MOTHER_RUSSIA
fix'd
 
Ven
okay, I guess it's drinking time then
 
more than anything I think I'm offended the most by his use of post increment on the control variable in loops
 
@Nisk In that case you're making poor choices about what to find offensive.
 
3:55 PM
@JerryCoffin given your poor choice in saying out loud that you think yourself able to judge what are and aren't poor choices - I'm semi-inclined naming you the poor-choices authority.
 
Xeo
@EtiennedeMartel actually, yeah. I've been overcomplicating this. Long day, mushy brain.
 
@duskwuff: OMG, you're downvoting an irrelevant answer for an irrelevant stupidly wrong reason. Is that irony? — Cheers and hth. - Alf 13 hours ago
 
there's good mush too
rice with milk and lemon zest
MMMM
that's good white mush
 
Hmmm. Now I want to eat mushrooms.
 
@therainmaker Your code is entirely wrong because you have not understood the assignment.:) — Vlad from Moscow yesterday
my god he puts :) on almost every comment now
good way to avoid suspensions I guess
 
4:07 PM
I can imagine him with a forced smiling face
in his mind: "I hope you get ebola."
 
yes
or
"I've just given you ebola."
 
@LightningRacisinObrit did he have a point however?
 
I have no idea
 
Because, while his attitude is dickish - I have seen my share of idiotic questions on SO.
 
4:13 PM
2832
Q: How do I correctly pass the string "Null" (an employee's proper surname) to a SOAP web service from ActionScript 3?

billWe have an employee whose last name is Null. He kills our employee lookup application when his last name is used as the search term (which happens to be quite often now). The error received (thanks Fiddler!) is <soapenv:Fault> <faultcode>soapenv:Server.userException</faultcode> <faultst...

:L
 
user1804599
@Ven have you tried Z3?
 
user1804599
I might use it for static analysis.
 
O.O
Who here does unit testing with c++ and native project in VS?
 
probably Braket
cos he's insane
 
O.O
4:15 PM
hmm. I am a total noob just about with c++. In order to unit test I have to make functions visible to test project. I got this to work with simple no dependency class...
but what if that class has an include to another of my headers? Do I have to export that class too in order to test one function?
 
user1804599
For finding contract violations and dead code.
 
@O.O the dependencies of your tested project become the dependencies of your test project
you can't test something that uses X without adding X or mocking it
 
O.O
Alex M. so testing a giant ball of wax basically means I have to expose every class and include every header in the test project?
 
@O.O No. There should be nice ways to test things that are not private (I'm only familiar with C# unit testing)
 
O.O
as am I
 
4:25 PM
I don't really understand what you mean by "every class"
 
O.O
but C++ is so god awful ugly and just not as nice :)
 
here's the idea
you have a project that uses a library called Y, and your project has foo.h that also includes a header bar.h from Y
in your test project you link with your own project (+ include path) and the moment you want to test what's in foo.h you also need to add Y to your include path
otherwise it won't find bar.h
yes it's messier than in C#
if you want C#-like functionality check D and its modules
 
XD
 
O.O
That's what I was worried about. Because even if I add an #include to every .h file in the test project to test one function, (I believe) I would have to _declspec(dllexport), _declspec(dllimport) every .h file
 
you don't need to #include every .h file to test a function
it seems there's something wrong with how you laid out everything
 
O.O
4:29 PM
I have a dll and I have a test project
 
right
 
O.O
no other external depends
in order to test a function, I have to declspec it to make it visible to test proj from DLL
if I repeat that process on a complex class
I get compilation errors
 
is the _declspec stuff required by the fact that it's .dlls being used? seems it's microsoft only
 
O.O
ya, I'm using VS to do the tests
according to their tutorial you have to do that
 
my library gets turned to .lib and I don't need to do anything fancy other than to just to link and include
 
O.O
4:33 PM
I have a .lib file too
 
> Dynamic libraries take this one step further. It seems wasteful to have multiple copies of the library functions taking up space in each of the programs. Why can't they all share one copy of the function? This is what dynamic libraries are for.
OIC
 
O.O
but not sure what it is for
I don't have to use microsoft's test stuff
 
56
Q: DLL and LIB files - what and why?

XonaraI know very little about DLL's and LIB's other than that they contain vital code required for a program to run properly - libraries. But why do compilers generate them at all? Wouldn't it be easier to just include all the code in a single executable? And what's the difference between DLL's and LI...

 
this is such shite journalism
> Police were called to reports a man had been stabbed inside a bar or restaurant in Lea Bridge Road, Leyton, at about 21:50 BST.
 
4:34 PM
Obviously not today as it's only 5.33pm but no indication of when it happened
article was posted eight hours ago
so we have to just guess it happened yesterday?
 
@LightningRacisinObrit bullshit time?
 
O.O
hmm
 
@milleniumbug You should call align on what you get from operator new, or at least assert that T is not overaligned.
 
I should learn about alignment
 
O.O
4:35 PM
now I am going to have to look into this lib stuff for a bit. Thanks for the tip
 
np
 
@R.MartinhoFernandes static_assert(alignof(T) <= alignof(std::max_align_t), "overaligned type"); ?
 
I'm hungry
 
Oh, not overaligned, but extended alignment.
 
4:38 PM
@O.O try google test
 
> bar or restaurant
you figure you'd at least do due diligence there, too
 
I think I'll have some grilled chicken
I want mcdonalds but I'll just stick to once/week
what the actual fuck is a cup of calamari
who measures calamari in cups
can you measure any animal in cups
 
@AlexM. That depends how big the cup is
 
@AlexM. Clearly yes - calamari, for instance.
 
how many cups am I I wonder
~9485 cups of Alex M.
actually this looks interesting
salmon fishcake with shrimps
it's not grilled so it's a huge chance I'll like the fish
I'll order it #YOLO
 
4:58 PM
who are you talking to
 
shut up :(
it's not like you're never dropping random stuff here
 

« first day (1644 days earlier)      last day (3287 days later) »