« first day (429 days earlier)      last day (4512 days later) » 

12:00 AM
you know what the best thing evar is?
I won't have to implement name mangling
 
Chocolate.
 
Anyone here know about a concept called "dispatch tables"?
 
the key word that should be on the front is "virtual"
 
Sounds familiar.
Context?
 
and it's how the compiler implements virtual functions
usually shortened to "vtable"
A virtual method table, virtual function table, virtual call table, dispatch table, or vtable, is a mechanism used in a programming language to support dynamic dispatch (or run-time method binding ). Suppose a program contains several classes in an inheritance hierarchy: a superclass, Cat, and two subclasses, HouseCat and Lion. Class Cat defines a virtual function named speak, so its subclasses may provide an appropriate implementation (e.g. either meow or roar). When the program calls the speak method on a Cat pointer (which can point to a Cat class, or any subclass of Cat), the calling ...
 
12:02 AM
@RMartinhoFernandes I'm trying to choose from a set of methods in an API, based on a stored user setting.
 
that article sure likes cats
 
Xeo
@Pubby Everyone likes cats
Or atleast they should.
 
Did I mention Boost.Exception is awesome?
 
Xeo
Why?
 
Because.
 
12:03 AM
I'm writing in Objective-C here, actually.
Looking into the concept.
 
@Xeo Cats suck. Dogs FTW.
 
objective-c in c++ chat?
 
Dispatch table is just a table of functions, or function pointers in primitive languages.
 
C++'s vtables are mostly the same
 
Xeo
One can't be objective about C
 
12:04 AM
@Pubby No, general coding concepts in c++ chat.
 
@Pubby He didn't ask about the language though.
 
but I believe that ObjC has more complex lookups
 
@RMartinhoFernandes I think you did. I'm not sure.
 
although why, I don't recall
 
@DeadMG I can use NSSelectorFromString, but I don't know if that's too much.
 
12:05 AM
@DeadMG Dynamic duck typing and all that.
 
In Python, it'd be something like { 'foo': func_a, 'bar': func_b, 'baz': func_c }[some_string](*args, **kwargs)
 
@Moshe I have no idea what that is.
 
@DeadMG ok
 
nor do I particularly want to
 
quick question: what is an ε-production?
 
12:06 AM
@CatPlusPlus What's kwargs mean?
@Pubby It's nothing.
 
@RMartinhoFernandes Keyword arguments.
 
@RMartinhoFernandes Nothing as in nothing? Blank?
 
ε means empty string.
 
12:07 AM
Aka nothing.
 
thanks, book left that section blank x_x
 
aaargh, I hate semantic analysis already
 
Xeo
You know, I just thought that user-defined literals would allow for far more efficient handling of string literals. Because they can only applied to them, you could tell std::string that it needn't copy the content, just have the pointer point to it.
 
Time to write your own string class!
@Xeo And then what? Make it a cow?
 
make it const, obviously
 
Xeo
12:10 AM
@RMartinhoFernandes Don't allow writes, obviously.
:D
 
Why are you guys telling me the obvious solution? Of course I know the obvious solution.
I just asked about cows because...
 
moo
what other reason is there to ask about cows?
 
I love your mother
3
oh wait, I only love the infinitely small part of her that fits into our universe
 
12:14 AM
what? I can't sing loudly because it's midnight and my flatmate is likely asleep
 
I got two helpful flags out of a single not an answer.
I didn't think that was possible.
 
argh
 
What is the most efficient way of storing non-overlapping ranges and searching if an particular element in present in any of the ranges ? strictly within in one of the ranges and they should not mix matched with any of the ranges !
 
made me think about university and how much I hate them again
 
12:15 AM
@Dumb You could try www.stackoverflow.com
 
Xeo
lol
 
@DeadMG Why?
 
user562566
Anyone interested in looking at some basic performance test code... that is NOT C/C++ just to double check that the logic is sound? There really isn't anything language specific going on that's going to prevent you from judging that. It's pretty simple code.
 
because
I need to submit my complaint to them about how horrifically they've treated me
 
Xeo
12:17 AM
 
and it occurred to me that I never got back to that woman at the Student's Union
 
@DeadMG You haven't done that yet?
 
eh, I still have at least six days left to submit it :P
 
user562566
Thanks for the code review link, forgot all about it!
 
Xeo
12:20 AM
- I thought SO's policy was "no fun allowed"?
 
also, I still hate their hideous inefficiency and the utter worthlessness of my modules
 
Xeo
3
Q: upside-down program in /usr/bin/games

Sideshow BobWas I imagining it? I'm sure many linux distros used to come with a program in /usr/bin/games that 'faked' upside down fixed width text. So for example if you input hello it would output o773y or something along those lines. But on the boxes I have logins on these days, it's not there, ...

> Excellent. Now I can send text to my mate in Australia. – Sideshow Bob
 
Ofcourse I tried stackoverflow. stackoverflow.com/questions/8511821/…
 
well, we don't exist because that guy didn't respond since you posted a comment six minutes ago
 
Is my default-reference class reinventing the wheel? Is this something like boost.optional<ref>?
 
12:28 AM
it's a kind of dumb idea
if you need optionality, take a pointer
 
What's wrong with boost.optional?
It's the awesomest.
 
nothing
although if the OP has tight memory needs, he'll need to go down to one bit per attribute
 
@RMartinhoFernandes Well, we also need the ability to use a reference to something existing, should this be desired
I'm not sure if the OP's requirements are sensible, but I thought the solution fits...
 
@DeadMG That must be really tight, or lots of optionals.
 
well, given by his post, I'd say that he either has one hell of a large data set, or he doesn't really grasp the difference between 8 bytes and 8 megabytes
check out the edit by Tomalak
 
12:32 AM
@KerrekSB It isn't similar to it.
 
wtf?
 
@DeadMG What about it?
 
well, all he did was remove some pleasantry
 
Well, if you can't use "Cheers & hth.", you shouldn't use "Thanks in advance".
 
for a start, I don't even see why it should be removed, and secondly, it's a waste of time to remove it
 
12:33 AM
It's a matter of consistency.
 
consistently stupid
I prefer inconsistency to stupidity
 
> ruined a perfectly good question with that cliché
lol
Isn't boost.optional like, specialized for references to become just a wrapper around a pointer?
 
no idea
ultimately, I appreciate the inherent simplicity of boost::optional, but I've never actually had cause to use it
 
@RMartinhoFernandes Yes, but that's an implementation detail.
 
What about pointer to parent + uninitialized aligned storage? Wouldn't that work the best?
No extra storage, no dynamic allocation.
 
12:41 AM
So, pointer to parent + optional<T>.
 
you pay for pointer to parent
 
@LucDanton Without the bool. The pointer can do that job.
 
you can't use one pointer to the parent to determine presence of n attributes
especially if the class needs a parent pointer anyway
 
@DeadMG I'm assuming you will need to pay for it in any case.
 
but he needs more than one attribute
and you can't use the presence of one pointer to indicate anything about more than one attribute
so you're paying 4bytes/attribute
 
12:42 AM
@RMartinhoFernandes Wait, one pointer to parent per attribute?
 
Oh, I'm misunderstanding the question then.
 
Xeo
So, my router decided to kill the wlan signal again
Any useful formulation of that, that I could feed into Google?
 
holy shit
my microprocessor applications course comes with a user's manual
for the 8051
 
Xeo
Have fun!
 
eight 1-byte registers
 
The 128 bytes of RAM
 
Sounds fun.
 
Xeo
@RMartinhoFernandes useful
 
the 80C51 is an embedded controller from the late 1980s
 
See you'll be dealing with things of your age.
 
12:48 AM
are you kidding? I was only born in late 1990
 
lol 19980.
OMG, some of you were born in the 90s.
 
Xeo
1991
 
it's 2012
 
people born in the 90s are starting to, say, fail their degrees
 
12:50 AM
Don't worry, I haven't completed mine yet. And I traveled here from 1987.
 
in a year we're gonna be seeing people born in the 2000s
 
OMG I'm old.
 
I've been speaking to my parents
 
Yeah, children do that.
 
and I'm starting to think that my problems with the university aren't just about the university
apparently, when I was a mere four years old, the school didn't have any books that I couldn't read, and my parents kicked up a nasty fuss about it
 
12:52 AM
"You taught my kid too well. You should be ashamed."
 
starting to think that that's the story of my damn life
hahaha
I didn't learn to read at school
they were holding me back
I learned to read at home
 
I didn't learn to read before I was five. When I first went to school, I was about six and a half years old. And you were held back?
 
Hi - I just made a demangling allocator that prints its own class name
Could someone take a look? It's not working quite right.
 
well, I exhausted the school's reading educational resources before I even attended
and they didn't exactly walk five minutes up the road and get a bigger book from the library there
 
@KerrekSB where
 
12:55 AM
Sort of here
Hm, doesn't compile... silly ideone
But, my own output is:
Default-construct: funky_allocator<int>
Destruct: funky_allocator<std::__detail::_Hash_node<std::pair<int const, int>, false>*>
Destruct: funky_allocator<int>
Default-construct: funky_allocator<std::_Rb_tree_node<int> >
Default-construct: funky_allocator<int>
Destruct: funky_allocator<int*>
Destruct: funky_allocator<int*>
Destruct: funky_allocator<int>
Destruct: funky_allocator<std::_Rb_tree_node<int> >
Destruct: funky_allocator<std::__detail::_Hash_node<std::pair<int const, int>, false>*>
Destruct: funky_allocator<std::__detail::_Hash_node<std::pair<int const, int>, false> >
 
when I was in kindergarten, there were 3 degrees of books: green, yellow, and red corresponding to their difficulty. There was a book with no words and it was marked yellow for intermediate. Never figured that one out.
 
It's missing a ton of "Default-construct"s.
 
Onoes, a singleton.
 
@sehe (Never mind the Demangler class at the top, that's just aux.)
@CatPlusPlus Very!
@CatPlusPlus This is all hidden. All you say is std::cout << demangle<T>() << "\n";
 
@KerrekSB: at least it's leaking like a sieve
 
12:57 AM
So, the problem is that most of the allocators don't seem to get constructed... only destructed.
@sehe The amount of leakage is bounded by the number of types in use
 
@KerrekSB Your excuses for singleton-yness are no better than the next newb's.
 
Actually, no, there's no leak
 
not really. by the amount of calls made to Demangler::demangle, if I'm not wrong
 
@sehe Nope, there's a fixed buffer that the demangle function uses...
anyway, this isn't the issue!
Why doesn't the allocator get constructed?
 
> Returns: A pointer to the start of the NUL-terminated demangled name, or NULL if the demangling fails. The caller is responsible for deallocating this memory using free.
 
1:00 AM
@sehe enough with the demangling! :-)
 
The singleton, it does nothing!
 
@sehe Note that I am indeed providing my own buffer. Your quote only applies if I provide no memory
 
yeah - i was slowly finding that out
sorry
 
Why are we getting hung up on slandering me? I believe I did my research on the demangler... and valgrind gives me a clean bill of health any day
 
Now , the issue is that you aren't seeing allocator construction? Did you debug that?
 
1:01 AM
The realloc requirement of the demangle primitive is the most arduous restriction
@sehe Well, my output doesn't show all the allocator construction calls to match the destruction calls
 
Now, who's getting hung up ?
 
@sehe No one :-)
 
@Feeds Ooh, exciting :-)
 
1:04 AM
as far as I know, he is of the opinion that frequent, moderate users should be on the list
 
Moderate?
 
and I see Kerrek here a lot and he's never given me the impression that he would be unsuitable
 
I think you mean insane.
 
of course, if sbi disagrees, he can always be removed
 
@CatPlusPlus My insanity only surfaces during full moon...
 
1:05 AM
We'll work on that.
 
Xeo
@KerrekSB, missing your output here? template<typename U> funky_allocator(const funky_allocator<U>&) throw() { }
 
@DeadMG I was joking.
 
@Xeo Aaaaahhh
 
Xeo
Internally the containers should copy-construct a rebound allocator from your allocator
 
lol
 
1:06 AM
Default-construct: funky_allocator<int>
Copy-construct: funky_allocator<std::__detail::_Hash_node<std::pair<int const, int>, false> >
Copy-construct: funky_allocator<std::__detail::_Hash_node<std::pair<int const, int>, false>*>
Destruct: funky_allocator<std::__detail::_Hash_node<std::pair<int const, int>, false>*>
Destruct: funky_allocator<int>
Default-construct: funky_allocator<std::_Rb_tree_node<int> >
Default-construct: funky_allocator<int>
Copy-construct: funky_allocator<int*>
Destruct: funky_allocator<int*>
 
Also, why throw() and not noexcept? Are you still using the more sucky C++ version?
 
Xeo
See, perfect. :)
 
@Xeo Thank you! And +1 for not whining about my demangler :-)
@CatPlusPlus I just nicked GCC's malloc-allocator for this
 
But singleton!
 
@Xeo: now whine about his demangler.
It's a singleton!
 
1:07 AM
@RMartinhoFernandes Can room owners kick out obstinate whiners?
 
Xeo
I don't care, my resource management system in my game is basically full of singleton maps
 
@RMartinhoFernandes Hey, it's a local-static at least...
 
You clearly know nothing about logic, programming and bananas.
 
Xeo
I wouldn't know how else to construct it
@CatPlusPlus bananas are @sbi's thing
 
@KerrekSB Being a well-written singleton doesn't make it any less a singleton.
 
Xeo
1:08 AM
@KerrekSB Thank you. And now post that as a question and let me farm rep. :P
 
Also, shouldn't you store the result of __cxa_demangle? In case it reallocs or something.
What? I'm an owner of the bin.

 bin

It's a bin, for binning things.
I wasn't last week.
 
Or just pack it in std::string and forget about the singleton.
 
I keep trying to find that room to dump messages in
 
I should have gotten a notice about it.
 
and it never comes up
 
1:10 AM
@RMartinhoFernandes Congratulations, you're now officially a garbage man.
 
@Xeo What, the "spot the error"?
 
ifyou search "bin", it doesn't come up
 
@DeadMG It's a gallery room. That's why you can't move to it. But now I can! MWhahaha.
 
oh that sucks
 
@CatPlusPlus You need to solve the realloc problem.
 
1:11 AM
make me an owner
 
@KerrekSB What realloc problem?
 
It workses!
@DeadMG Working on it.
 
@CatPlusPlus The problem is that if you want to pass a pointer to your own memory, it must be reallocable. That is, it must have been obtained by malloc().
 
@CatPlusPlus The demangle function may call realloc on the memory you pass to it (if any).
 
1:12 AM
You can't just use a handy std::vector<char> or so.
 
Xeo
Now I want 10k rep on Programmers.SE:
 
char *tmp = __cxa_demangle(typeid(T).name(), nullptr, nullptr, &status); std::string ret(tmp, tmp + strlen(tmp)); free(tmp); return ret;
 
Xeo
in bin, Dec 14 at 4:03, by Feeds
0
Q: Am I blind or is JavaScript a pile of brown stuff

JesseI read several books including the Good Parts by Doug Crockford. After careful study, I must admit that JavaScript is pure dog doodoo. Only a junior programmer would be exited about coding is such a garbage programming language.

 
Or something like that.
 
1 message moved to bin
 
1:13 AM
Did you get a notification of ownership or something?
(Other than the message Feeds posted in the bin room).
 
no
it refreshed the page when I was made an owner
but no notification or anysuch
 
Chat not behaving like you'd expect it to? Well I never.
 
Chat should do that. It was only by accident that I realized this.
 
brb, need piss
3
 
I see how that's vital information.
 
Let's take over the bin!
Mwahahah.
 
@CatPlusPlus, @RMartinhoFernandes: Fine, if either of you gentlefolk come up with a solution that's genuinely better, you will have my foreverian respect, and I will change my code. Requirement: Single library inclusion, and demangle<T>() should produce some string-like value. Here is my current version.
 
@KerrekSB I can't see a thing there.
Oh, wait, JavaScript.
 
@RMartinhoFernandes D'oh. Impatient C++ fool ;-)
What is this, zero-latency land?
 
Fucking "modern" websites that can't show a single drop of content without JS.
5
 
1:16 AM
@KerrekSB Haha, my own way of doing is very ugly IIRC.
 
@LucDanton You're exempt, you didn't rail against my Demangler for 20 minutes :-)
 
Btw, I'm not adding that as a JS exception :) So I can't see your current version.
 
@KerrekSB You see my edits?
Dunno how that thingy works.
 
@CatPlusPlus I'm watching!
 
Well, that's about it.
 
1:18 AM
tits, it's cold
 
@RMartinhoFernandes Good point. Here is my original.
 
Necrophilia is bad, you know.
 
@CatPlusPlus I'm changing it!
@CatPlusPlus What do you think?
 
You have to check whether buffer is there, anyway.
 
int status;
auto const demangled = annex::make_unique(annex::raw = abi::__cxa_demangle(s.c_str(), nullptr, nullptr, &status),
                                          annex::with_deleter = std::free);
if(status == 0) {
    return demangled.get();
}
return s;
 
1:20 AM
You're responsible of freeing it.
 
Is what I use apparently.
 
Is free well-defined on receiving nullptr?
 
unique_ptr won't call it if it's empty.
I think.
 
@CatPlusPlus Yep
 
I was referring to the collabedit thingy, not Luc's snippet.
 
1:21 AM
@CatPlusPlus You have dynamic-allocation extravaganza supreme there!
@LucDanton Ah, the Dantonian method. Who is annex?
 
Meh.
One copy more won't hurt.
 
@KerrekSB Namespace for my 'toolbelt' library. I put useful stuff here, like make_unique.
 
Everyone has make_unique.
 
even I have it
 
@CatPlusPlus everyone::make_unique
 
1:23 AM
If you don't have make_unique you can't call yourself a C++11 programmer.
 
@CatPlusPlus Can yours use named parameters like mine?
 
everybody::dance
 
Checkmate.
 
@LucDanton Well, no.
 
@LucDanton How do you cope with "no deleter"?
Specialization?
 
1:23 AM
But I had version working without variadic templates.
 
@KerrekSB There's several ways to call make_unique, some of them without the need for named parameters.
The classic make_unique<T>(u, v, w...); is here when you have no deleters to pass for instance.
 
Oh, what's that "status" flag... we're not checking that I think
 
You could add a check if you want to throw on error.
 
@KerrekSB Out parameter for error handling.
I don't remember if you can pass nullptr instead or not.
 
He had nullptr in the previous version and it appeared to be working.
 
1:27 AM
@CatPlusPlus Ah, we could check that and add "[Invalid Name]" responses etc.
 
Xeo
@RMartinhoFernandes #define make_unique(T, ...) (std::unique_ptr<T>&&) std::unique_ptr<T>(new T(__VA_ARGS__))
 
how about [Your Mother] responses
 
Xeo
Does that count too?
 
Well, I'd throw, but that could work too.
 
why on earth cast to rvalue reference?
 
1:27 AM
@Xeo Ugleh.
 
@Xeo Ugh. A macro? Seriously? Shoot it.
 
Xeo
 
See, nobody likes it. Burn it.
 
also it's unsafe
func(make_unique(ILikeToThrowWhenConstructed, ...), make_unique(ILikeToThrowWhenConstructed, ...)); -> memory leak
 
@LucDanton Hang on, doesn't that return a dangling pointer?
 
Xeo
1:29 AM
How to: Piss off Lounge<C++>
a) post a singleton or
b) post a macro
...
 
make_unique(std::vector<int, my_allocator>, 5) <- crazy errors.
Ok.
 
lol
 
@KerrekSB Return type is std::string, there's a silly implicit conversion.
 
Why is everyone talking about piss lately.
 
1:29 AM
Season finale of Dexter airs in three and a half hours!
 
@CatPlusPlus DeadMG needs it, apparently.
 
Xeo
Also, doesn't anyone realize I'm kidding? Or am I not realizing you're kidding too?
 
Maybe none of this is real.
 
@RMartinhoFernandes I took a piss
 
Xeo
@DeadMG That's not what your message says
 
1:30 AM
16 mins ago, by DeadMG
brb, need piss
 
To where?
 
yeah, and now I'm back
 
Read it again.
 
I'm not seeing it
 
There's a "to" missing.
 
1:31 AM
'need' vs 'need to'.
 
maybe if you don't know how to speak English
 
I read that as "BRB NEED PISS STOP", telegraph-speak. So no confusion here.
 
STOP PISSTIME
 
Xeo
 
1:32 AM
@CatPlusPlus ROFL
 
@LucDanton Yes, of course. Are annex::raw and annex::with_deleter global objects?
 
@KerrekSB Yes, think std::nothrow.
 
@LucDanton I don't usually think std::nothrow if I can help it :-)
In better news, I was totally wrong about std::list: it requires three allocators!
 
1:42 AM
that's shockingly relevant
 
Why is there all this hashing going on? In deque, too.
 
Xeo
Just what I wanted to ask the same, why all those _Hash_nodes?
 
Lion is back
 
1:57 AM
AHHHH @Xeo, your edits are spamming the front page!!! lolz jk
 
Xeo
:)
I wonder if the Meta Police will step in and give me a suspension
 
44s ago Xeo 21.7k
3m ago Xeo 21.7k
20m ago Xeo 21.7k
 
they do tend to wank over us
 
Xeo
 
Though... why am I still browsing the site...
I'm capped already I should be playing l4d right now...
 

« first day (429 days earlier)      last day (4512 days later) »