« first day (512 days earlier)      last day (4428 days later) » 

12:00 AM
@rubenvb Please tell me the name is an intentional pun. “Butterbrot” (pronounced like Buddhabrot) in German = “sandwich”
 
I don't understand the point of karma. It's not like it's shown everywhere
 
The point of karma is getting people to post interesting stuff instead of crap.
People don't realize it's useless.
 
@Xeo precision() means decimal places for fixed format but significant figures for scientific and general formats.
 
The Big Bang Theory lets me feel smarter without having to understand any actual math & physics.
There should be a sitcom about programmers.
 
True.
 
12:17 AM
I hate that is depicts all male nerds as being comic book fans.
 
The only comics I enjoy are xkcd and ragecomics from reddit.
Maybe I just like black and white.
 
No Beartato?
 
Never heard of it.
 
Keep the webcomic suggestions coming, please.
 
Clients from Hell is also fun, though not comics. More like text.
 
12:22 AM
does anyone seen the v for vendetta before ?
 
Rewatched it a few days ago.
 
comics
 
Cyanide and happiness is good
Axe cop and Dr. McNinja are neat
 
I liked Perry Bible Fellowship, but the guy stopped making them.
 
12:27 AM
Well, for better or for worse, it’s on reddit now.
 
@StackedCrooked if (it != vec.begin() ?
 
Oh yeah..
 
@EmileCormier Yeah, you can use a lambda: int main() { auto f = []() { std::cout << std::vector<int>(4); }; f(); }.
 
Ok, and std::for_each and lambda?
 
Actually, can't you use std::copy?
 
12:28 AM
@KerrekSB I mean to replace the index-based for loop.
 
std::copy (vec.begin(), vec.end(), std::ostream_iterator<T>(os, ", "));
 
@Konrad 3 upvotes already, neat.
 
@StackedCrooked If you want hyper-efficiency, you can write it as a loop-and-a-half
But otherwise, no, you need some sort of distinguishing the first element.
 
@daknok_t Doesn’t display that for me …
but then, upvote displays seem to jump randomly anyway
 
@KonradRudolph That's awesome. I'll email it to my colleagues at work.
 
12:31 AM
Reddit skews the votes, but not through their JSON API.
 
@KonradRudolph : Make that into a T-shirt and I'll buy it.
 
I'm a fat-ass XXL so it should all fit.
 
@Emile if you actually really want that, there is special paper available you can put in your printer and afterwards stick on a T-shirt using an iron.
 
@daknok_t : I'm boycotting inkjet printers, but I'm sure I can find a shop in town that could print that for me.
 
12:37 AM
 
@daknok_t Yeah, I don't ever want to buy a printer again. If I need to print something I do it at work or at the library.
 
Trolling the library: they ask 6 cents per page. Print a hundred pages that are fully black. Really worth it.
 
I can't figure out why printer manufacturers seem to totally forgot about the printer models that turn out to be reliable.
 
They want it to break so you buy a new one.
 
12:45 AM
It's like reverse-evolution. Extinction of the fittest.
 
I took a look into the Norton AV 2006 source code today. It was written in C with Classes. Can't believe that I've ever used that piece of sh*t.
 
Norton IS a virus. It completely takes over your PC.
Well, it did back when I used Windows as my everyday OS. Maybe it's not so bad now.
 
It contains this code:
class someclassname {
public:
    // Constructor
    someclassname();
You don't say? :D
 
Does it really say "someclassname", or was that you?
 
No :P something like CSmartScan or something.
Also stupid: let's prefix all class names with a C!
 
12:52 AM
argh, re-watching Arrested Development
it’s killing me …! “I wanna please you secularly” :-D
 
@daknok_t: It hate it when they repeat the class name in a method: size_t String::stringLength() const
@Scott W : It's Microsoft who popularized that. See [Hungarian Notation] [en.wikipedia.org/wiki/Hungarian_notation]
 
@ScottW the Norton source code leaked today, so it didn't come from Norton.
Is there any decent free and open-source AV software? Not that I'll use it, but I am just wondering.
I like to use the same style as the standard. Lower case, underscores, no camelcase.
 
user406009
The problem with following the standard's naming style is that you see. fum = foo(a); Now, before looking up the type of fum, is foo a function or a constructor?
 
I've been using Microsoft Security Essentials on my gaming PC. I figure Microsoft should know about Windows' security holes better than anyone else. :P
 
user406009
Far too ambiguous.
 
1:01 AM
If you use decent naming you won't get such ambiguities.
 
@EthanSteinberg Why does it matter that you should know whether this is a function or a constructor?
 
My editor highlights type names differently from function names. :P
 
Coding style holy war!!!
 
user406009
@LucDanton Matters on whether I start looking in foo.cpp or somewhere else. But it is a really stupid example.
 
Put braces on a new line and indent the opening braces with tabs and the closing braces with spaces!
Indent all the things!
 
1:03 AM
@EthanSteinberg Yes, I expect you're working in an environment that lets you look that up that at the press of a key :)
 
I like capitalizing class names because then I don't have to think of clever prefixes or names for instance variables: Rectangle rectangle(4, 3); as opposed to rectangle a_rectangle(4, 3);
 
@EmileCormier YES! SO SO THIS!
@EthanSteinberg You shouldn't really have to know. Consider a constructor as a function that returns a T. Now they are identical.
 
Note that's it's possible to do rectangle rectangle(4, 3);, although that tends to be frowned upon. Personally I use e.g. std::vector<T> vector; a lot.
 
well, I do think that variables should be given reasonable names
 
1:09 AM
Sometimes I do use capitals. class XML_parser, class iPhone_device
 
but I also find it irresistible for tiny-scope variables to give them nothing names
 
Yep, sometimes a tuple is just a tuple.
 
By "nothing names", do you mean something like a or x?
 
nah, I usually name by type when doing that
Rectangle rectangle; and that kind of thing
 
1:11 AM
I suffix member variables with an underscore if they are private. example
 
I won't hesitate to use single-letter variables in a small scope if it's going to be used in a math formula.
 
yeah i like that style
 
@daknok_t Camel_case? wowch
 
arr = [1, 2, 3]
arr = []
arr << 1
arr << 2
Or maybe it's <<<
 
is this javascript?
 
1:22 AM
Ruby
 
There are too many programming languages.
 
And FALSE is the only reasonable one.
 
What's the deal with programming language names that are difficult to search?
 
It has stacks and lambdas. Who needs more?
 
1:24 AM
man
Roll To Dodge is awesome
 
C++ has only identifiers and the postfix increment operator. so simple
 
What would it be like? C++ with a GC and static if?
 
Single-die rolls don't model the gaussian distribution of such success/failure events. I like the approach used in the Fudge RPG system.
 
can anyone tell me how to make a function return a pointer by reference, is it possible?
 
int*& foo();
Then just return the pointer.
But see the starred messages in the sidebar and look for the ones about pointers.
 
1:33 AM
Does anyone remember the last time they had to do a deep copy?
 
Who's they?
 
anyone
:P
 
Ooh in that way.
Can't say I do.
 
yeah, wrong pronoun, probably
 
fuck that
 
1:37 AM
Heil grammar nazi!! :-)
 
are you still talking about anyone
 
Parsing English is even more difficult than parsing C++.
 
English has nothing on French. At least there aren't genders for inanimate objects.
 
i wonder whether English is turing complete?
 
Lol parsing Dutch. "Henk at een appel." is about the most simple sentence and it's already ambiguous.
"at" has two meanings, and "een appel" and "Henk" can either be the object.
 
1:40 AM
yeah , and when you try to learn french, you waste your first month justing trying to figure out who's male and who's female
 
but not at the same time.
Possible translations: "Henk ate an apple.", "Henk was eaten by an apple.", "Henk drinks an apple all at once." and "Henk is being drunk by an apple all at once."
 
The genders aren't even remotely related to the inanimate object in question. It goes by what rolls better off the tongue. For example "épée" (sword), a manly thing, is feminine.,
Esperanto!!!
I started to learn it but never gave it any dedication.
 
My French teacher always said that a "voiture" (car) is feminine because it's got round shapes.
 
@daknok_t That's to help memorize and/or a joke, not an actual thing.
 
I know. :P
 
1:45 AM
Boats have a gender in English, though.
And M14 rifles.
 
Should I use boost::scoped_array or std::unique_ptr with a deleter?
 
@EmileCormier But not the word 'boat' itself and so on, it's not strictly speaking the same thing. The same thing happens in other languages including French, too.
@Pubby E.g. std::unique_ptr<int[]> already comes with an appropriate deleter (i.e. it uses delete[]).
 
@LucDanton How does it work? I thought int[] would be int*?
 
Not in template parameters.
 
Oh, I didn't know that. Is that a new feature?
 
1:50 AM
No.
 
T[] is a type distinct from T*, and has been coopted by std::unique_ptr for use with dynamic arrays.
 
Why didn't auto pointer support that then?
 
And T[] has always been distinct from T*.
@Pubby Separation of concerns, presumably.
std::shared_ptr doesn't have special support for dynamic arrays either.
To clarify, std::unique_ptr<T[]> is a special case. It didn't come naturally.
T[] isn't a type that is very much usable in fact.
 
What do you mean?
 
You know, like void.
You can't do void f; and nor can you do int i[];.
 
1:54 AM
I would always prefer std::vector and std::array over T[].
 
@LucDanton But unique_ptr can be written in user code, right?
It doesn't involve magic?
 
No, it doesn't involve any magic.
 
@Pubby I don't understand that question.
Are you asking if std::unique_ptr is in fact usable? Why would it be in the Standard library if it isn't usable?
 
@Luc Danton magic means that it needs special support from the compiler, like type_info and initializer_list.
 
Yeah, could I write a my_std::unique_ptr and have it behave identical to std's?
 
1:56 AM
Ah, is the question on how it can be implemented then?
 
@Pubbh, Yep
 
You said it was a 'special case', I just didn't know if that involved magic
 
No magic is needed indeed. The Standard mandates a partial specialization to make std::unique_ptr<T[]> special.
 
Ok
 
It's special in that for instance std::tuple<int[]> doesn't work.
 
1:57 AM
you don't even need a partial specialization to support it
 
Implementing unique_ptr shouldn't be too difficult. Especially in C++11.
Is this possible? (I don't have a compiler on my iPod)
 
I've rolled my own unique_ptr
 
using T = decltype([]{return 42;});
T foo;
foo();
 
Did Boost ever get around to providing 'unique_ptr` for C++03?
 
Xeo
Not yet, but I think it will someday now that Boost.Move exists
 
2:01 AM
@daknok_t Lambda expressions can't appear like so in an unevaluated operand. Regardless of that though (you can in fact get around that limitation), no, the type of a closure object is not default constructible.
 
No it's 8°C.
@Luc Danton thanks!
 
boost::unique_ptr would have been nice when implementing the pimpl idiom. For some reason boost::scoped_ptr gave me errors and I had to resort to shared_ptr even though the pimpl was never shared.
 
It's past 3 AM so I'm going to sleep. :P
 
Funny how 0degC feels frigid during the fall, yet balmy in the middle of winter.
 
@EmileCormier Works fine on my end.
I'm guessing your code attempted to use delete with an incomplete type.
 
2:07 AM
@LucDanton : I don't remember exactly. I'll have to dig that code up and maybe ask a question on SO. I think it's because I was forward declaring a Pimpl struct as a nested type inside the class in question.
 
The documentation has an example, boost::scoped_ptr was definitively designed to be used with pimpl.
This is relevant because it works out exactly the same if you use std::unique_ptr instead (well you get move semantics of course).
 
The Shoe struct is not an incomplete type in that example.
 
@EmileCormier It is to all users of the class.
Wait, what Shoe?
Wrong example (sorry, no content table on that page), scroll down to "Handle/Body Idiom". Aka pimpl.
C++11 does bring that you can now do T::~T() = default; when implementing a destructor, although that affects readability, not semantics.
 
@LucDanton Oh yeah, implementation is an incomplete type. Maybe they fixed the issue I had.
@LucDanton : I now seem to remember an explicit destructor causing the problem. I'll see if I whip up a small example that replicates the problem i had.
 
@EmileCormier I doubt it. Going back as far as Boost 1.31 there's still the example in the docs.
 
2:15 AM
@Luc Danton : The problem must have been between the keyboard and chair, then. :)
 
Remember that you still have to use that technique with std::unique_ptr and an incomplete type!
 
Is there a pastebin with C++ compiler that understands "= delete"?
 
@LucDanton I do!
somebitch told me you could use unique_ptr with an incomplete type without deferring the destructor definition BUT THEY WERE WRONG
 
lol
std::unique_ptr<incomplete, std::function<void(incomplete*)>>
Not that I've actually tried...
What do you know, it compiles. The check (and associated requirement) is in std::default_delete, not std::unique_ptr. As it should be.
 
waste of a run-time abstraction, IMO
 
2:29 AM
@LucDanton : Ok, I replicated the problem with`boost::scoped_ptr` and pimpl. I'm getting the error when I leave the default implicit destructor. When I declare the destructor explicitly and provide an empty implementation, the error goes away! Thanks, Luc.
 
2:51 AM
I've used boost::scoped_ptr a lot with pImpl. It requires a user-defined destructor of both the surrounding class and Impl in the same compilation unit.
 
user406009
3:47 AM
Anyone know how to parse a stream from twitter?
 
user406009
Like to be notified when a new tweet is posted in c++?
 
I suppose Twitter has documentation for its api.
 
user406009
But what would be the suggested way to integrate with webservices in general with C++?
 
user406009
Is there a general library, or am I just going to have to start using regex, creative boost::formats, and libcurl?
 
I would probably use Poco's HTTPClient library.
There's also boost asio.
If you need to parse an XML stream then you can use Poco's SAX parser.
SAX makes XML almost cool.
 
4:17 AM
Excuse the perhaps-obvious question:
0
Q: Where is cout declared?

MosheMy computer science professor wants us to find the declaration of bout. I've compiled a simple Hello world program using g++ and the -E parameter. Here's what my hello.cpp looks like: #include <iostream> using namespace std; int main(){ string name=""; cout << "Good morning! ...

 
Xeo
@StackedCrooked Answer with standard quote > answer without one :D
 
Dammit.
:D
+1'd your answer.
I have to say that it's an unusual assignment.
 
Xeo
Yeah
 
4:39 AM
Excuse me, I have a quick question.
Who here has a computer science or computer engineering degree?
 
Nobody?
 
5:02 AM
What would I call a variable that is an intermediate holder of data that later gets 'committed' to the master variable? Does 'staging' make sense?
 
You mean what you should name it?
 
Yeah
 
XXX_temp or something... that's what I do.
 
It's not really temporary though, they're both class members
 
Sometimes I'll do XXX0, XXX1, XXX2, if there are multiple temporaries.
 
5:06 AM
Oh, and @Mysticial, do you know of a good size to perform malloc allocations in?
 
define "good size"?
are you trying to make a reusable buffer?
 
It's for a text editor buffer
 
this->value = value;
 
And yeah, it's reusable, although reallocating is expensive
@Vortico ??
 
Your question 6 minutes ago.
 
5:09 AM
@Vortico Not sure if I understand
 
Assuming you won't have millions of these "text editors" at once, you can probably start with a pretty large buffer and double up when it gets full.
 
Nevermind, I guess I don't either.
 
Is 2^16 too big?
 
You can it pick it pretty arbitrarily. Anything between 2^10 and 2^20 is probably still reasonable.
 
Ok, thanks. Guess I can always change it later
 
5:13 AM
But reliability purposes, you can probably start it with just 1 byte.
That'll force your reallocation code to be tested very often.
 
Good idea
 
and only when you're ready to tune it for performance, do you finally set it to something sensible like 2^16...
I do a lot of stupid tricks like this to avoid writing unit tests... :)
 
5:39 AM
@Pubby preliminary
 
6:33 AM
It's 7:33 AM here.
 
 
1 hour later…
7:34 AM
 
 
1 hour later…
8:57 AM
omg... a recent SO question just got reddited and the top answer shot through 100.
That makes it 14 this month.
 
@Mysticial which one ?
 
91
Q: Why is reading lines from stdin much slower in C++ than Python?

JJCI wanted to compare reading lines of string input from stdin using Python and C++ and was shocked to see my C++ code run an order of magnitude slower than the equivalent Python code. Since my C++ is rusty and I'm not an expert Pythonista, please tell me if I'm doing something wrong or if I'm mis...

That's the 14th 100+ answer for the past 30 days. I've never seen such a strong month before.
AFAIK, only 4 of those got to 100 because it was linked.
Usually, there's no more than 6 or 7 100+ answers in a month.
Heh... it's a performance question. Linked by Jeremy Banks.
 
9:19 AM
Can somebody tell me why this question is getting so much upvotes? stackoverflow.com/questions/9653722/…
 
Good question...
good as in your question about why it's getting upvotes.
 
he studied computer science and doesn't compile with -Werror stuff
 
9:47 AM
Isle grew upvotes aren't that many upvotes.
 
It's a lot for this time of the day
 
@KonradRudolph You seriously don't see a buddha figure in it?
 
sbi
Good morning, folks. Anyone here?
 
Yes.
 
Here, but will be sleeping soon.
 
sbi
9:56 AM
I haven't been here for days. Have I missed anything important?
 
not really
 
Not that I know of. We talked about C with Classes, slide shows about pointers, coding style and movies.
 
sbi
What? I'm away for three days and you get boring?
3
 
There were fucking pointers as well
 
sbi
(Typing on a touch phone is a mess.)
 
9:58 AM
SlideIT!
^ most awesomest Android keyboard ever
 
Connect it to a Bluetooth keyboard.
 
sbi
Huh?
 
If you connect your touch phone to a Bluetooth keyboard you can type more easily.
 
sbi
I don't travel with a Bluetooth keyboard.
 
Oh you are in London, right?
 
sbi
10:01 AM
Sigh. That question was @rub about the keyboard.
Yes, I'm in London.
 
Cool.
 
@sbi it's a very customizable, multi-lingual keyboard and you can do swype-style typing on it, but I find it better than Swype.
 
sbi
I wish I knew how to reply to messages in this mobile version of the chat.
 
You cannot, unless you magically know the message ID.
 
The mobile version truly sucks balls
 
sbi
10:03 AM
@rub And it's an app?
 
change your browser's User agent to something Desktop-y and just use the normal chat
@sbi yeah, let me dig up the market link
 
Menu -> Non-mobile view
 
it has a 14-day trial
 
But if you zoom in everything is screwed up here because of the fixed layout.
 
sbi
But the normal chat won't fit on this screen.
 
sbi
Given the name I suppose I can find an app myself...
:(
Well, thank you anyway.
 
Does anyone know any good resources on a Bomberman AI? (Google didn't help much.)
 
sbi
Ok folks, I hear my host rattling in the kitchen, so I'd rather get into that shower now. Normal operations will resume on Wednesday night.
 
10:41 AM
I think we have a candidate for the most nonsensical comment of the year
 
10:54 AM
lol
 
11:46 AM
I actually did something productive today.
 
@jalf Since when does C mandate passing arguments on the stack? lol
 
why hello
Are the objections listed herein still valid with C++11’s make_shared?
16
Q: Are there any downsides with using make_shared to create a shared_ptr

Tobias FuruholmAre there any downsides with using make_shared<T>() instead of using shared_ptr<T>(new T). Boost documentation states There have been repeated requests from users for a factory function that creates an object of a given type and returns a shared_ptr to it. Besides conven...

 
Sort of. For instance the Standard doesn't mandate that a call to std::make_shared results in only one allocation, but implementations are encouraged to do just that.
The bit about deleters is very much in currency however.
 
@Luc To be honest I don’t even understand the point about the deletion and weak_ptr. Why would deletion be deferred in this case?
 
The point of boost::make_shared is that it's an optimization where only one allocation happens.
If you do boost::shared_ptr<T>(new T) two allocations take place: obviously the one associated with the new expression, but another one during construction of the shared pointer to hold the reference count.
As boost::shared_ptr is not intrusive.
 

« first day (512 days earlier)      last day (4428 days later) »