« first day (557 days earlier)      last day (4393 days later) » 

Xeo
1:17 AM
@RMartinhoFernandes Except that for each is broken as heck
 
1:36 AM
There is a question "How is data structure useful? " and points that came in my mind include 1) Allows efficiently store data 2) which in turn allows a data value to be searched and found easily. what else can I add ?
 
Xeo
@FailedNoob: "what else can I add ?" -- a duplicated question, most likely
 
@Failed_Noob Put simply, it organizes data in a way that certain constraints are always satisfied, allowing you to make guarantees about its behavior.
 
@GManNickG Thats a good answer, Thank you
 
Xeo
room topic changed to Lounge<C++>: alt-0153 [c++] [c++11] [c++-faq]
3
 
Xeo
2:17 AM
@ScottW That was the prior topic, and the joke behind the current one.
 
2:45 AM
you know, the room title is a tad offensive
it assumes us elite C++ coder snobs are running Winblows
of course, on the other hand, Linux is written in C
since Linux is in C and not C++, it's beneath us
I suppose we should all just roll our own operating systems
I'm sure I can encapsulate my hardware better than Microsoft did
and their style - no RAII, poor use of templating, etc...
I mean, I'm an elite C++ coder, so I'll make a realistic project assessment. how long to develop a replacement for the Linux kernel that is compatible with both it and Windows? I think I can have it done in 3 weeks with the power of C++
That is,
The Power of Syphilitic C++ (std's sprinkled everywhere liberally)
You know, I replaced the f1 key on my keyboard with an std:: one. Literally, it has std:: on it and when I press it, std:: is typed. I figured since I'm an elite C++ coder I never need help with anything, so the f1 key was just taking up space anyway
In fact, call me std::OrgnlDave
There, now you can.
 
sounds good
 
Hey Datalore, what's your namespace?
I'm not sure if that's a pickup line, a pun on astrology, or both
 
How is it a pun on astrology? I think I am missing the point, not being familiar with astrology
 
"Hey baby, what's your sign?"
What country you from?
 
United States
How about you?
 
3:00 AM
Same. Got anything interesting to talk about involving coding?
 
Well I was actually wondering about the semantics of reinterpret_cast somewhat
 
What would you like to know
I happen to be an elite C++ expert
 
This library i am using allows me to store a single void* with each instance of a class as user data, and I wanted to put an int
So i did reinterpret_cast<void*>(myInt), which seemed to work
 
You mean literally, int a = 4; and you want that 4 stored in the place of the void*?
 
yes
 
3:02 AM
ok, first you need to do something else
intptr_t = 4;
sorry
intptr_t myInt = 4;
reinterpret_cast<void *>(myInt);
wait
nevermind everything I just said
go at it old-school C style
void *datapointer;
int myint;
int *myint2 = (intptr_t)myint; // note lack of &
datapointer = (void *)myint2;
 
Okay, and so then when I get the value back out, I cast it to a intptr_t first from a void*, and then to an int?
 
I mean, technically you can just do void *ptr = (void *)((intptr_t)myInt));
well, we've taken a value of an integer and put it into a pointer. then we've cast that pointer into a void type. we do that in reverse to "unpack" it.
int output = int(ptr);
that should work
let me see if it throws compiler errors, I'm currently causing MSVC to dump core with some metatemplates so hold on while I wait for it to stop
 
The method you gave for packing it seems to work without compiler errors or warnings
 
OK, core is dumped
sorry, I like to abuse my compiler
waiting for ideone to get to my example code now, just a sec
c-style casts are good that way, you can abuse the crap out of stuff however you want
 
For future reference, is there anything wrong with doing it with reinterpret_cast?
 
3:12 AM
reinterpret_cast is meant to cast from pointer type to pointer type
you're casting from integral point to pointer type and back
is there anything wrong with it? I'm not sure
I do know it's not what it's meant for
 
So it's also wrong to use reinterpret_cast between ints and floats to extract/set the bytes?
 
nevermind that
what the heck am I on?
 
A place where people send words to each other about things
 
reinterpret_cast works fine, it's just dumb and ugly. what you're trying to do is really a C thing; reinterpret_cast<> is a C++ way of doing it. you can do it if you want to. there's functionally no difference that I know of
 
okay then
i'll leave it as your C-style way for now
 
3:17 AM
question: what ya doin with that? I'm assuming you're storing a unique ID?
 
yeah, it's to pass in the unique IDs for my own objects to their corresponding representation elements in the GUI
 
mind if I ask what library you're passing to?
 
CEGUI
 
oo, never seen this one before
 
that's the API reference for the root class of the graphical elements
 
3:20 AM
I hope Crazy Eddie's library design is better than his web page's screenshot section design
 
there are getUserData and setUserData functions that take void*
 
so, may I ask why you're not just passing pointers directly to those objects?
 
in the rest of the program, the unique IDs are being used instead of pointers to the game objects, as the game objects can be destroyed (and deleted) arbitrarily
it's difficult to notify the rest of the program (many different places) when something is deleted
 
so you keep a list of valid object IDs
 
there is one class that holds the valid IDs, and the other objects can get the pointers out of that when they need to
but they do not hold the pointers
 
3:23 AM
how does that class search for an ID?
or insert a valid one? or delete?
 
which class? what do you mean?
 
the one that holds all the IDs
 
it keeps a std::map of the IDs and pointers
 
do you ever need to iterate over it?
 
yes, sometimes
 
3:24 AM
mmm. cool, thanks for satisfying my curiosity
 
well the project is open source, i can link you to the website where we have it if you want to read more
 
with n being the number of IDs being tracked on a regular basis, what is the size of n?
 
it's likely to get up to around 10^4 at most
 
and how many objects are requesting from this std::map all the time? like, let's say, do we have 5 different functions grabbing each pointer and working with it every frame?
 
yes, that is possible
 
3:27 AM
how many objects are inserted and removed per second, would you say?
 
objects are being resolved from IDs vastly more often than they are being inserted and removed
 
single-threaded application?
 
right now, yes, but we would like to leave the possibility open to add in threads without too much effort
 
are the objects of only a few distinct types? is there an upper limit on the number? sorry for the intrusive questions
 
the IDs are actually separate for each type, and there are only a small amount of them
small amount of types, that is
 
3:31 AM
well then, it strikes me that if you're having performance issues (or are expecting to), there's much better ways of doing it. but if it's performing well for you, they're not worth reimplementing a working system
 
we actually don't know how well it is going to perform, as we haven't implemented most of the code that actually invokes all these functions
 
ahhh
 
what would you suggest doing differently?
 
hmm, well I don't know all the details, but I'd probably use an 'object pool' for each object type, basically a big array (or a few big arrays), from which I would allocate the maximum number of objects of that type
they would have a 'valid' or 'invalid' marker;
the void* would point directly at the valid or invalid marker
 
implementing a memory pool is planned for the future, but is not currently there
 
3:35 AM
in order to handle insertions and deletions, I would use a separate hash map (std::unordered_set) to keep track of that memory pool
this would give things constant time access to pointers (instead of logn), and constant time insertion and deletion(since it's managed using a hash map)
but that's making an assumption about how your data flow goes
the tradeoff, of course, would be that iterating over an object pool could be a bit expensive, but I imagine that your object status object pools would fit in cache and wouldn't be much of a burden
 
0
Q: Weird Error in WinMain() to main() Macro

IntermediateHacker/** converts 'WinMain' to the traditional 'main' entrypoint **/ #define PRO_MAIN(argc, argv)\ int __main (int, LPWSTR*, HINSTANCE, int);\ int WINAPI WinMain (HINSTANCE __hInstance, HINSTANCE __hPrevInstance, \ LPSTR __szCmdLine, int __nCmdShow)\ {\ int n...

 
IntermediateHacker, I am an elite C++ coder, so I may come to the rescue
 
with an object pool, though
as you describe
you hand out pointers and such and reallocate over blocks that are no longer valid
what if some object holds a unique identifier for a really long time without attempting to use it?
something else might have been allocated over that spot in your memory pool by the time it tries to use it
 
@Datalore could you please rephrase that? I am imagining in my head that an object's unique identifier would in fact be its index in the array
@IntermediateHacker why are you defining __main right before you use WinMain?
 
so some other object is holding a list of unique identifiers that are related in some way
to itself
but it does not try to actually dereference them for some time
and one of these objects is deleted in the meantime
there is the possibility that something else gets allocated on that index in the big array, which has been free for some time
 
3:45 AM
oh, I see what you are saying
 
there is another case that makes holding the unique identifiers useful
 
I suppose I'd add a counter to it: every time it is deleted, the counter is incremented. if that object has the wrong count, it knows the objecti n the pool is invalid
well, it knows the object isn't the one it thinks it is
 
@IntermediateHacker: There ya go.
 
@GManNickG you beat me to it by like, one second
 
so now each object that has references to other objects also has to keep track of the "deletion counter" to make sure it is not referencing something else?
there are many interrelationships between the object classes, which is why it is so awkward to attempt to notify everything that could possibly be referencing an object in some way
 
3:50 AM
@Datalore yes, but on the other hand each of the 5 times it accesses that object, it only has to do O(5) operations instead of O(5*logn + constant for structure that keeps it to figure it out)
and since objects can acquire the pointer to the unique ID they want, they don't need to even query a holder object - they can just take a pointer to the object with the unique ID and keep track of what they expect the destructor count to be. much shorter path to actual data
basically you replace a holder that takes O(logn) every time you want to look something up with something that lets you have direct access to your objects, look up IDs in constant time, and when 'holding' them, do 1 check on them (destructor_count == expected_destructor_count)
 
that seems like a significant burden on the programmer every time he/she wants to get the actual objects out of the identifiers
just a lot of awkward extra checks littered throughout code
there is another case where having the distinct unique identifiers is helpful; there are some instances where an object might be silently replaced with a proxy to it, which behaves in a similar way externally but is a different object entirely
 
those akward checks can all be replaced with a short, concise inline function, or if you're using OO style, inherited from a base class that provides that functionality
as far as proxies go, you can simply overwrite the data without updating the destructor_count
I could code up a short example in about 10 minutes if you're truly interested. if not, I should get to bed
 
another issue is that we have a system of essentially silently-replacing objects with other objects. not all IDs resolve to the same things at the same times; there are actual versions of objects (which are the full, real object) and intel versions (which have the same interface, but limited use, and are usually a copy of an old version of the object). that makes anything other than resolving IDs highly problematic
(i am the head designer, he is the head programmer, if the sudden addition of a new person clarifying things is confusing... ;) )
 
i believe i just mentioned that, bakaiya D:
although you said it better than me
 
oh
that happened while it was telling me i couldn't talk
 
4:00 AM
okay
 
if you're interested, I can code up a short example that will be much clearer. if not, I should get to bed
 
sorry, we're not really looking to overhaul that part of the system at this time
i think you should just go to bed
we will consider what you have said if we run into significant performance issues
 
after abusing my tendency to mess with memory to attempt to fix it
 
that's no fun. OK, goodnight, I wish you guys the best. oh, can you link the project?
 
onathacar.project-data.net/trac/browser
there will be a wiki... as soon as my server stops acting odd
and a proper domain, as soon as he stops being lazy about it
 
4:03 AM
I thought you said there was info on it here?
 
i do not believe i mentioned there was any information
 
i have no idea what he said
 
we have yet to write the documentation
 
i just started paying attention
 
what's the URL for pulling a GIT clone?
 
4:04 AM
i simply offered that you could look at what we had, but did not say there was any more extensive information
i haven't figured out yet how to set up git properly for multiple users, so right now it is hidden behind a SSH login
 
aww :-(
 
we both have kind of crappy servers, it seems
seems like it should be possible to download via the site
but no idea how
i really inspire confidence
 
yeah...not gonna fire up cygwin just to do a wget for all the files atm
can you point me at a relevant one?
 
to the data stuff? world.cpp
 
The World class (World.h, World.cpp) contain the central maps
contains*
 
4:07 AM
thanks @GManNickG
 
localmap.cpp and intel.h are sort of stubbed versions of the intel system
 
OK but what should I lookat for a crash course in the object-id use?
 
data.h contains a lot of the actual access functions in form of templates
world pretty much outlines the rules for how IDs work
i am just now getting to the first bit of logic that actually calls up IDs
 
any reason you're not using a tuple for a triad?
 
no, probably just didn't know it exists. needed something rather urgently to do that so i just shoved it in. if something else does that... well i feel stupid then
 
4:11 AM
i thought you were trying to avoid using all the new c++11 features immediately
 
see i don't know what it even is
it's C++11? that makes sense, then
 
tuple isn't C++11 :-P
 
C++11, also formerly known as C++0x, is the name of the most recent iteration of the C++ programming language, approved by ISO as of 12 August 2011, replacing C++03. The name is derived from the tradition of naming language versions by the year of the specification's publication. C++11 includes several additions to the core language and extends the C++ standard library, incorporating most of the C++ Technical Report 1 (TR1) libraries — with the exception of the library of mathematical special functions. C++11 was published as ISO/IEC 14882:2011 in September 2011 and is available for a fee....
gah
i linked to the specific subsecction
 
oh wait
 
subsection*, i don't know if that carried through
 
4:12 AM
it is? stupid MSVC,it tricked me!
 
tuple can support 3 elements?
 
i hear MSVC does not care too much for what the standards say
tuple can support any number of elements
 
i actually read the headers and it seemed to only be doing two
 
oh, they do lately
 
or i might have gotten suspicious
 
4:13 AM
Wasn't tuple support for TR1?
 
especially if you're going for concurrency, VC is quite good
 
and only support windows
 
We're developing primarily from linux
 
yes, that's the annoying thing, they placed it in std:: namespace not std::tr1, the jerks
 
VC++10 supports tuples, but there's a maximum amount of elements because it's implemented with macros instead of variadic templates.
Or at least, that's the way I remember it
 
4:14 AM
oh, are either of your running Windows and have an older version of VS handy?
 
well at least i didn't just completely screw up by making my own class, if this much confusion surrounds 3-element-tuples
 
@EtiennedeMartel well, there's always Boost::tuple
 
Yeah, but boost::tuple has the exact same limitation.
 
i have windows but don't use it
 
oh, that question wasn't implying you screwed anything up
 
4:15 AM
well
i thought i did by reimplementing something available
 
that's not the end of the world
unless you're reimplementing std::map or something
 
everything is the end of the world! the world as i know it ends every moment
i'd need a good reason to do that much work
although i did make a container
 
@Bakaiya I was just suggesting that, being an elite C++ coder, I should roll my own OS (since the linux kernel is C and windows just sucks)
 
but it wasn't STD or boost supported so that was sensible
the linux kernel would be a lot better if it was a microkernel
but it's sort of too late to fix that now
 
hurd is progressing slowly but steadily
 
4:17 AM
it is like sea level
some day it will hit a point where we have to care
but no one will until it does
 
hurd isn't progressing slowly because of a lack of support, it is because the design is flawed
the real-world performance of the microkernel is just terrible
 
plus hurd would mean a lot of things need completely reworked
maybe in the 90s
windows uses a microkernel
 
no it doesn't
which cites a microsoft curriculum resource kit
 
well, it's more micro-kernel than linux, at least
monolithic kernels are just pretty dated
fine for servers, but there are still a lot of issues otherwise
 
lots less issues than microkernels have though :-P
oh @EtiennedeMartel, hello
 
4:22 AM
haven't really been that many to make a conclusive argument. at this point it is less structure and more the fact we're stuck with what we have, lest all the drivers and higher-level components be replaced
linux barely gets by with drivers as it is, if hurd solved all its problems, it would still have issues unless it somehow managed to be completely compatible with linux drivers
BSD gets by, but if you go completely changing architecture, it probably won't last
 
I'm not going to stay up late debating if a microkernel is better than a macrokernel. micorkernels lost out to macrokernels; microkernels have had consistent and good development put into them for a long time and they still just suck. when that changes when they make magic fairy sprinkle dust that makes them perform decently, I'll change my mind
 
are templates automatically inlined?
templated functions, i mean
 
Function inlining is totally implementation-dependent.
 
i wasn't really trying to debate. probably what would be better is a hybrid, but staying stuck in monolithic for all eternity isn't a good idea
 
windows is a hybrid
linux is monolithic
 
4:29 AM
Okay, thank you @GManNickG
 
@Datalore that really depends, you should declare them inlined if you want them to be, but they generally follow the rules normal functions do
 
@Datalore In almost all cases it does well enough. Best way to know is to check the assembly output.
 
i was just curious, really
 
there are other more pressing concerns about whether a function gets inlined than if it's a template
sadly, there are no template lambdas :-( although I suppose in most contexts that doesn't really matter
 
Xeo
@stdOrgnlDave It sure does, it completely gets in the way of generic programming
 
4:34 AM
Template Lambda? I think my head just exploded.
 
Are you saying you can't create a lambda function inside another function that is templated?
 
Xeo
@Mysticial Polymorphic lambda
@Datalore No, you can't have the argument types inferred on a lambda
 
oh great...
Goes to show how much my C++ is lacking...
 
You sort of can, I actually asked a question about this earlier
if you consider this function
 
We're saying this does not work: [](auto x){ std::cout << x << std::endl;};
 
4:35 AM
i programmed an incredibly confusing and ultimately pointless system of building comparison functions out of classes and function pointers. was more fun than practical in the end... i've never seen a binary that large
 
ah i see
 
Xeo
@Datalore You can play around with decltype and such, if you've got a container you extract the values from or something, but else...
 
classes and function pointers templated, that is
 
11
Q: C++11 does not deduce type when std::function/lambda functions is involved

DataloreWhen I define this function, template<class A> set<A> test(const set<A>& input) { return input; } I can call it using test(mySet) elsewhere in the code without having to explicitly define the template type. However, when I use the following function: template<clas...

 
does anyone have VS9 or 10 handy? anyone!? can you compile a short snippet of code and see if it causes CL to dump core for me please?
 
4:36 AM
Imaginary syntax, of course, but the point is that it expands to something like this:

struct
{
    template <typename T>
    void operator()(T x)
    {
        std::cout << x << std::endl;
    }
} __lambda;
 
@GManNickG I've actually seen someone do something very, very akin to that
@GManNickG 'simulating lambdas before C++0x support for them' he said
 
@stdOrgnlDave Yup.
I have VS10 handy, by the way.
 
@GManNickG pastebin.com/8PcGtHzq see if it makes CL dump core for you? it'll take a few minutes
 
@OrgnlDave: Test.
Why was it prefixing std to your name?
 
I updated my profile to be std``orgnldave
2 hours ago, by OrgnlDave
you know, the room title is a tad offensive
a small bit I wrote that led to my rebirth
 
Xeo
4:40 AM
If anyone deserves a std tag in front of his name it's @litb
5
 
@OrgnlDave: Compiling...
 
Xeo
Or Howard or the other guys from the committee, I guess...
 
@Xeo Ya. Has litb actually gotten on the committee yet?
 
Xeo
I don't think so
 
are you saying I'm not deserving of the handle?
 
Xeo
4:41 AM
He just continues spamming them with DRs I think
 
hey Xeo, what's your namespace?
:: is what it is, loser
:-D
 
Xeo
lawl
 
@stdOrgnlDave Is that supposed to be a pickup line?
 
Xeo
I'm global. Globals are dangerous. I'm dangerous.
 
@Mysticial if only you were here earlier...that and other things were explained in a monologue by me
@Mysticial it can be conveniently found at chat.stackoverflow.com/transcript/message/3435839#3435839
 
Xeo
4:43 AM
namespace yourmom = std;
yourmom::insert(...);
 
it is recommended reading
 
Xeo
Anyways, Black Lagoon just finished loading, AFK!
 
@stdOrgnlDave oh geez... somebody must've been really bored. :P
@Xeo Dude that show was over a while ago?
 
Xeo
Sure was
I didn't watch it yet, though
I also just watched "The Girl who leapt through time", which is from quite a while ago
 
I still remember dling the BluRays for the OVA.
 
Xeo
4:45 AM
And FMA:Brotherhood
Dammit, that series is so awesome
 
@Xeo Ooooohhh yeaaaahhhh.
 
Xeo
Had a good 20h marathon with that one
 
@GManNickG did it dump core or complete succesfully?
 
@stdOrgnlDave Still compiling. : |
 
Xeo
I read the manga quite a while ago, so I knew what was coming, but it was awesome to see it animated.
 
4:46 AM
 
I had a modified case where it didn't even spit out any errors, but I didn't save it
it just dumped core and said it failed
no "compiler stack overflow" error
 
@Mysticial Haha.
 
There are 10,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000partic‌​les in the universe. your mother took all the ugly ones and shoved them into one nerd
 
Xeo
@Mysticial Make it a descriptive link, quick!
 
@Xeo how?
too late, it's locked
 
Xeo
4:48 AM
[description](url)
dang it
 
@GManNickG still compiling?
 
Yup.
 
@GManNickG what rig are you running?
 
Xeo
@stdOrgnlDave Don't press for it so hard, I'm sure he'll tell you when it's done
@GManNickG Sure hope you compiled in release :P
 
@Xeo how about this?
According to this diagram, your mom would be fatter than Jupiter's orbit.
 
4:49 AM
Old one. :) P4 3.4ghz, pseudo-dual core.
@Xeo I did actually. :3
 
Xeo
@Mysticial Don't give away the joke. :P Just something about sizes in the universe
 
@GManNickG on a 2.3GHz core 2 duo I have compiled like 5 times in debug trying to recreate the error-less dump...maybe it's faster in debug...
 
Xeo
Imagines how @Mysticial is trying to come up with a witty description.
 
@stdOrgnlDave How much RAM and swap-space do you have?
 
4gig ram, it's not using swap
I'm compiling release now, it's taking longer
 
4:56 AM
Interesting. Maybe I'll stop it and try again in Debug.
 
you may have inferred
that it was an attempt to use templates to create a ridiculous amount of pointer indirection
maybe it is optimizing it away in release
 
that sounds awesome
 
someone in here wrote it, I can't take credit, I just love things that abuse compilers. it makes me want to make GCC dump core using a similar technique
but first I must know if it's just my machine that it dumps on
and I'm still compiling release, it dumped way before now in debug
I was honestly wondering what would happen if I used pointer indirection that wouldn't fit inside my cache
like, all the pointers to further pointers, being larger than my cache
I imagined it would make things horribly slow
I was going to do some simple math and benchmark it
 

« first day (557 days earlier)      last day (4393 days later) »