« first day (88 days earlier)      last day (4854 days later) » 

9:01 PM
@Mahesh, I bookmark them also and have them all under a SO folder, and synced with my laptop + work computer with Chrome.
Never lose any useful information :)
@FredNurk, agreed. Most of the things I have marked as "Favorite" in the past have actually been "Interesting for a day or so."
 
only good thing about favorites is you can get a list of them from your profile
 
@MooJuice: What you seem to do is interesting. Will try that.
 
I have a dumb question.
I have some code that checks some numeric responses from a server. They're generally grouped in groups of 5-8 and then various logic is done based on what they are.
I was about to write some code like:
if(response() == RplA || response() == RplB) .. do something on these 2
is there something in boost or STL
then would let me provide a functor and a list of possibilities?
e.g, execute_if(response(), a, b, c, [](){ /* execute if response() is a, b or c});
thought I guess it wouldn't be hard to write if it isn't there already.
 
9:19 PM
@Moo: whenever i try to find a "more elegant" way to do that, I end up with the if you had originally
 
Good advice.
 
@Moo: Strictly speaking, you could use a std::map<response, std::function<signature>>
then it'd be like
 
it's fast & self-documenting. note you felt the need to add a comment to your boost-y code to explain what the original code needed no comments for
 
map[RplA] = map[RplB] = map[RplC] = map[RplD] = [](){...};
 
@deadMG, I use something similar to get several hundred response codes to these "group" handlers in the first places. This is just fringe cases that need some extra action when they are of a certain value.
I guess as John says, the if() is pretty clear for 1,2 or 3 cases
 
9:21 PM
yeah
the lookup table is only for more extreme cases
 
Yeah, I use a std::map in the exact way you've outlined to actually map the bulk of them.
 
could consider a std::unordered_map
since I noted your lambda expression there
 
ah, thankyou.
 
9:44 PM
@JohnDibling the notification on "favorites" at least works well with other SO notifications, but honestly I would rather that be done through feeds (question feeds don't have all the comments that favorite notifications have, I think)
 
hm, i never looked that closely. i only use it as a cheap bookmarker
 
I'm not certain. I have noticed question feeds miss comments on answers (but not comments on the question)
I think favorite notifications might include comments on answers
I'd call it a bug, but I've not looked into it
but by "works well", I was more meaning the interface, for those that don't know what "feed reader" means
 
never really used RSS
 
ive never found an rss reader i liked
 
@JohnDibling, same.
Tried google's reader for a while, but it annoyed me quickly.
 
10:00 PM
ohai sbi
don't think you can sneak in here without me noticing
 
i want one that works like chat
 
leaving comments from a feed reader would be nice, sometimes
if that's what you mean
 
the trouble I had with reading the feed was that I got all questions
whereas when I go to SO then I get only the ones tagged C++ or C++0x
 
@DeadMG you want a specific tag's feed, or a tagset feed (which are on stackexchange.com and can span multiple sites)
example: see the c++ tagset posted into this room
 
anybody use regexbuddy?
 
10:16 PM
it's always seemed a bit superfluous to me; but then again, so has most of the confusion around regex, from the very beginning of when I was learning them
 
I never really liked or used regexs
 
i love regexbuddy
been using it for years
 
sbi
@KonradRudolph Welcome to the chat!
 
regexbuddy just puts fancy colours and an interface around that which you can find out with boost::regex and std::cout << :)
 
@sbi hi
 
10:20 PM
@Moo: bah!
 
uh … quick question from a chat luddite: why do I have an “admin” access panel that shows flagged messages? Is this normal?
 
it helps me write regexes much quicker
shows that for me too
 
ywa
yes it is
 
sbi
@KonradRudolph If you need a few hints, the bar on the right has a message pinned to it that sports a few newbie hints from me.Or take the FAQ link on the lower right.
 
@John, I was mostly being facetious. I am sure if I used it, I'd be writing them faster too...
 
10:20 PM
oh wait
no, no it isn't
I thought that once you had over 10k rep you had all the privileges?
I get one on the main site, but not in chat
 
sbi
@KonradRudolph I'm not sure what you're referring to, but, as in SO proper, anyone can flag messages.
 
anyway i was looking for a Boost plugin for regexbuddy. guess nobody has one :(
 
oh hey
"What's wrong with const?" got closed again
 
@sbi: but on SO I’m not used to being able to see the flags, only moderators do ;-) Anyway, thanks for the newbie hints. I do take the hint ^^
 
oh, @James is here. I guess its beer-o-clock!
 
10:22 PM
Did someone say beer?
 
Ha ha ha
I need a beer.
 
sbi
@MooJuice Say? I'm having one right now!
@JamesMcNellis There's another one in my fridge. You can have it.
 
what kind, @sbi?
 
beer's terrible
 
Dammit. I have no beer in the house. Just wine, gin, port and whiskey.
 
10:23 PM
@KonradRudolph you can see chat flags just like you can see flags on SO proper (as anyone with 10k can)
 
sbi
@JohnDibling wernesgruener.de
 
@sbi that's what you always drink, isn't it?
 
sbi
@JohnDibling That's what I prefer if it's available. If not, I have to resort to others. :)
(And I'm flattered that you would remember.)
(But then, you're the one who defines the end of his workday as beer-o-clock, so who, if not you?)
 
@MooJuice easier to use a repl (e.g. python, ruby, and on and on) :)
 
the end of my workday is the time that I get up in the morning :P
 
sbi
10:25 PM
@MooJuice I have a port here, too, but I usually only drink it after a great meal. (Like last weekends roast. Yum.)
@DeadMG You're doing night shift?
 
@DeadMG ah, I hear that. life was so much different when I worked in a sleep lab
 
lol
no
I'm a student
 
sbi
@FredNurk Haha! You did?
 
no, I'm just joking, unfortunately :)
 
DeadMG, RE: your const question... there was an elongated discussion about the shortfalls in C++ and why it didn't make it in to C#, here: stackoverflow.com/questions/3263001/…
 
10:26 PM
lol
 
Maybe that will give you some food for thought.
 
sbi
@MooJuice I stopped reading after the first few sentences. Motivating the total absence of const in C# by the fact that it can be casted away in C++ is ridiculous.
(On my German keyboard, # is right beside the enter key. Dammit.)
 
@sbi, well whether it belongs in C# or not, or whatever the motivations, I thought there was enough discussion on it with regards to C++ to feed DeadMg's (now closed) question :)
 
@sbi The reasoning that Eric didn’t want possibilities to subvert the type system is sound. But the consequence is wrong: disallow const_cast, allow const.
Of course, this also has problems (what about mutable?) but it’s a start
 
sbi
Following this logic, they shouldn't have made private data a C# feature, because you can #define private public in C++.
@MooJuice That question had been closed and re-opened all day. Do not fear for it...
 
10:30 PM
well sbi
I guess you said you were playing the repwhore answering my question
 
@sbi, lol okay :)
 
18 upvotes :P
 
sbi
@KonradRudolph Yeah. const is one of the things I miss most in C#. And templates.
@DeadMG Yeah, it worked, didn't it? <beg>
 
man
life sucks without templates
 
@sbi Next time I am in Germany I will take you up on that :-)
 
10:32 PM
lol sbi, I'm not gonna go upvote you, you've had enough upvotes for one answer :P
 
good god, there are 50 comments on that one answer
 
sbi
@JamesMcNellis Oh, yeah! That would be great!
 
@sbi I'm glad I'm not the only person who thinks the "const isn't in C# because it's totally broken in C++" is a poor argument.
 
sbi
@JohnDibling Which one, mine? I haven't looked at SO for hours!
 
he is right in some ways, though- const isn't a guarantee
and if the man wants guarantees only in his type system
then that's his choice
 
10:34 PM
that const post linked to earlier
 
sbi
@DeadMG When you're as close to the metal as C++ is, what is guaranteed?
 
@KonradRudolph The real question is: is there something better? If there is, I'd like to know what it is (because I'm interested). If there isn't, and C++'s const is the best there is, then from a pragmatic standpoint it is good.
 
sbi
You can defeat almost everything in C++.
 
he's not designing C++, he's designing C#
 
@sbi 55,000 questions on Stack Overflow prove that!
 
sbi
10:35 PM
@JamesMcNellis What do those defeat? Common sense?
 
although
holy shit, he's being patient with the responders
 
@JamesMcNellis Something better? No. You do have readonly for member variables and that allows a good compromise (and in fact it does have some advantages over const since a read-only collection cannot change its reference but its content … bit like a const pointer).
 
if I were him, I'd be setting their asses on fire
 
sbi
Anyway, @Konrad is here because I'm lured him in after this:
@tweetsbi You’re involved in the StackOverflow [c++-faq] project, right? If so, how about this Q? http://bit.ly/fX9g4B
 
haha, I just wrote this code in my header:
using namespace std;
using namespace boost;
LOL take that!
 
10:37 PM
YOU BASTARD
 
@JohnDibling Beware the velociraptors! xkcd.com/292
 
@Konrad: LOL
 
@KonradRudolph I didn't mean something better in C#, I meant something better, period. That is, I meant "is there something better than C++'s const that could be implemented in the CLI or in some other language?"
 
@sbi don't know about C#, but I don't miss const in Python
 
well
I was planning on using concepts as a superior alternative to const
 
10:38 PM
@sbi They demonstrate that people actually try to defeat everything :-)
 
that is, you would define a concept that is a subset of your interface and you would say- here, that's "const T"
 
@FredNurk I actually do.
2
A: What are the drawbacks of Python?

Konrad RudolphI hate that Python can’t distinguish between declaration and usage of a variable. You don’t need static typing to make that happen. It would just be nice to have a way to say “this is a variable that I deliberately declare, and I intend to introduce a new name, this is not a typo”. Furthermore, ...

 
sbi
That got me thinking: How about we add a feed to this room for c++-faq questions? That would be a low-volume one (and we would definitely want to know if it wasn't!). But since it would sport questions that might already be fed in here by the feed Roger set up, I thought I would add it so that it is posted as messages by that Feed guy. Anyone violently opposed to that?
 
@DeadMG That's kind of the proposed solution to "const" in C#: use an IConstX interface and only include methods/properties that don't mutate the object. It's just a lot of work, IMO.
 
sbi
@FredNurk Neither do I, but then I never used Python, so...
 
10:40 PM
@JamesMcNellis Well, then: make const the default. I agree with @sbi that it’s seriously underrated by most developers.
 
sbi
@JamesMcNellis Haha!
 
@KonradRudolph I don't agree with a lot of Eric's const post, but something he said in the comments applies here: you don't want a language with every potentially useful feature, and Python simply doesn't have const, var, let, etc.
 
sbi
@JamesMcNellis But we don't need C++ to prove that people can defeat anything, do we?
 
the thing is
Eric mentioned things like automatic parallelization and memoization
is that stuff actually realistic?
is there going to be any compiler, ever, that will automatically parallelize and memoize my functions for me?
 
@KonradRudolph I've been thinking of an alternate python (or maybe merely python-like) syntax that used := for definitions (borrowed from many other languages), so var := value is your let var = value – and this does seem an addition I'd want
 
10:43 PM
the level of performance data you'd need to make those decisions is surely outside the realm of static anaylsis
even if you knew which ones were valid and which weren't
 
well, without the read-only connotation you have
 
@DeadMG Many compilers, including Visual C++, provide dynamic analysis-driven optimizations as well (in Visual C++, Profile-Guided Optimization/PGO).
 
ah yes
I'd forgotten about PGO
 
@DeadMG AFAIK there are experimental modes for Haskell that do both. For languages that provide aliasing? No chance.
 
But I don't think it does automatic parallelization. I think it's possible, though. It'd definitely be an interesting problem to tackle.
 
10:44 PM
well
I've been thinking about how aliasing in C++ could be reduced as a problem
but I can't really see how it could work
 
sbi
@Konrad So I went and read that question, and I don't believe it's a good candidate, because I don't think this is a frequently encountered problem. (FWIW, I never heard about anyone running into this problem before.) Your answer is certainly good, and the question isn't bad either, but it's not frequent.
 
I mean, I could say, let's ban primitive pointers and arrays, OK
even if I somehow automagically implemented stuff anyway
it would be pretty hard to stop
unless you wrote a version of new that returns a version of unique_ptr that you can never release
 
@sbi Fair enough … that’s why I was asking. I’ve completely lost track of which C++ questions are frequently asked and the SO search isn’t too great.
 
To continue beating the dead horse, the lack of const is one of the things I find most frustrating about C#, especially since objects are always passed by reference :(.
 
sbi
@KonradRudolph Amen to that last part.
30
Q: The Wikipedia of Long Tail Programming Questions

sbiSo I have just read the newest blog entry and it seems to be addressing something I had brought up here before, namely a way to deal with the constant stream of duplicated questions. It's interesting, and the way I read it it is encouraging what I wanted: Assembling a set of FAQs for a specific s...

Wow, it's crowded here tonight. Makes me thirsty. @James, since you don't seem to be interested in that beer, I'll have it, if it's all the same to you. (In fact, I'll have it even if it isn't. Yes, I'm that mean. Cheers!)
Haha, the ultimate proof that bugs riddle MS:
 
10:50 PM
Sorry, that page doesn’t exist!
 
sbi
@DeadMG So I see! Did he delete it?
 
how should I know? all I did was click the link :P
 
sbi
The giant bug which guards my office http://yfrog.com/h2czryoj
 
I’m off … being harrassed by an evil spirit
bye
 
sbi
@KonradRudolph Your gf? :)
@DeadMG Ah, I must have messed up copying the link. Mhmm. Sorry.
 
10:52 PM
how about
dynamic aliasing functions
rather than saying that anti-aliasing should be a language feature or compiler-enforced
if you had, say, a vector of shared_ptr's, it'd be just o(n) to check if they alias each other
and what their ref counts are
 
@sbi Heh. I'm glad my team moved across the street!
@sbi Zing!
 
sbi
@tweetsbi it was a prize for fixing the most bugs on the languages teams in VS 2010.
 
@DeadMG that's O(n^2), you have to check every item against every other item
 
nah
sort them
ok, it's not o(n)
but you could sort and then iterate
 
sorting is O(n log n) time + O(n) space :)
 
10:57 PM
If it's not O(n) it must be O(ff), no?
 
lol
why not just go the whole hog and say O(fuck)?
 
and if the unsorted order isn't important, then you really are starting with a [multi]set instead of a vector
 
sbi
@JamesMcNellis You're O(ff) the mark, James!
 
copy it first
copy it, sort it, iterate throughit
not the most efficient thing ever, I guess
 
It's been one of those days.
 
10:58 PM
Hi!
 
@DeadMG: if you just want a container of pointers which follows RAII and can't have weird aliasing, use a boost::ptr_container
 
there is always that
also
I was reading that SCARY paper
 
smart containers of pointers are often overlooked in favor of dumb containers of smart pointers
 

« first day (88 days earlier)      last day (4854 days later) »