« first day (686 days earlier)      last day (4263 days later) » 

12:19 AM
@ManofOneWay thes is good?
 
@ManofOneWay What's it about?
 
12:39 AM
the lounge is silent, something's (not) going on here
everybody's out drinking or something? :P
 
It's the weekend.
 
I've been caught by surprise by the cool evening air and I'm shivering deep inside my bed.
 
@R.MartinhoFernandes: so that's a yes? ;-)
that's what I would do, you know, if I wasn't addicted to code
 
posted on September 01, 2012 by Herb Sutter

The following is not intended to be a complete treatise on atomics, but just an answer to a specific question. A colleague asked: How should one write the following “conditional interlocked” function in the new C++ atomic<> style? // if (*plValue >= 0) *plValue += lAdd  ; return the original value LONG MpInterlockedAddNonNegative(__inout LONG volatile* [...]

 
@LucDanton lol
@Feeds Dear Mr. Sutter, would you please post the damn solution to GOTW #105?
 
1:06 AM
Ugh, I borked my VPS install.
 
 
1 hour later…
2:22 AM
giggity
 
2:33 AM
I'm on a roll with inventing anti-patterns today.
 
nice task
 
3:15 AM
hey guys
 
hallou
 
check this question and its answer, what do you think?
 
link or it didn't happen
 
4
A: Can the CPU understand programming languages?

Mohamed Ahmed NabilA large part of the answer is this: C++ source code (or any high level programming language) is stored in a text file, just as you might store an essay or a memo. But text characters are stored in numeric form. When the compiler works on this data, therefore, it’s doing another form of number c...

 
You answered your own question.
Haven't seen that in a while.
 
3:19 AM
"The CPU (the “brain” at the heart of the computer) doesn’t understand a word of C++, yet it performs the translation between C++ and its own internal language". That is not an unsolvable paradox. You've stated in the paragraph above that one, that the translation is done by the compiler.
 
@Rapptz They're not too common. It usually only happens when someone manages to solve their own problem, of if the person is trying to put together an FAQ.
 
I was under the impression that C/C++ just translated code into assembly
 
@Rapptz It's not required. The standard says nothing about that. So you could theoretically build an interpreted implementation.
 
When i get data from a text file and i want to store it in an int. I read the data into a char array and then use atoi, is there a better way to do this?
 
std::string and std::istringstream ?
 
3:28 AM
There are more C++-like ways to do that than atoi(). Ask some of the other guys here. I suck at C++.
 
@Rosme When i get data from a text file can i store it straight into an integer. ?
i can do this obj << 55; but not this obj>> int x
 
@MohamedAhmedNabil Don't think so. But you can store it into an std::string and then convert it to an int with std::istringstream.
Would have to be tested with a : int x; obj >> x;
 
@Rosme or atoi(string.c_str())
@Rosme i just wrote it like that here to make it short
 
Don't mix C and C++. if you use string, use istringstream. If you use Array of char, use atoi.
Anyway, I was just coming by real quick, already leaving. But make some research on that, you should be pleased with the result(possibly)
 
@MohamedAhmedNabil stoi if you're using C++11
 
3:35 AM
@Rapptz oh i dont know, i just know it is C++ XD
 
Though, I'm actually not sure of the portability on it. Same with atoi
 
@Rapptz When using text files i should input and output using char arrays, correct?
 
like std::ifstream in(filename.c_str());?
because I don't know about that. I've always used the regular string without the conversion to C string and it worked fine.
 
i mean this
fstream obj("file.txt");
obj<<char_array;
obj>>char_array
 
Don't do that. It's risky.
 
3:41 AM
why?
 
posted on September 01, 2012 by DanielMoth

Hopefully by now you have heard of C++ AMP. C++ AMP is a modern C++ library (plus a key new language feature) that ships with Visual Studio 2012 and it lets you take advantage of accelerators, such as the GPU, for compute purposes. Think data parallelism, but at a massive level, accelerated by powerful hardware. If you need more motivation on how using C++ AMP can speed up code,

 
i gtg, too sleepy
 
bye
 
@MohamedAhmedNabil There can be more characters to read than there is room in the array. Then you're screwed.
 
hello
 
3:45 AM
Hello
 
3:58 AM
what's your plan for the long weekend
 
4:43 AM
I plan to do your mom.
 
@StackedCrooked Stylish.
 
Of course :P
 
Well, PONPONPON is still as messed up as I remember it.
 
Hm... that's quite .. Japanese.
 
Yeah, although it's far less disturbing than what the British can do.
 
5:02 AM
TBH the Japanese are capable of doing more disturbing things.
 
The problem with the Japs is that what they're doing isn't dark, it's quirky. So it doesn't make a lot of sense, but it's easy to deal with, and you don't feel like you've been raped in the face afterwards.
 
I don't think I'm gonna watch that then.
 
@StackedCrooked Actually, you have to. It's 17 minutes long, and it's worth it.
And then, star that, so that others may see it.
 
5:36 AM
the "free browser add on from Ask" bundled with Java update: anybody tried it?
how much harm does it do?
 
I don't do add ons to my browser.
They're all generally garbage.
 
this is the second update with that add-on bundled (and you have to OPT OUT)
i think it's like the end of Java
the problem is Java is need to access internet banking in norway
:-(
 
nubberies
 
6:41 AM
@R.MartinhoFernandes Wikipedia says RAII had been invented by Stroustrup, and it links to the TD&E book which appeared in 1994, therefore RAII must have been "available" in 1995. @bokan
@R.MartinhoFernandes RAII is discussed on page 389 of TD&E, which itself links on to the second edition of TC++PL, so RAII must even have been available in 1991! Does anybody have the second edition to check?
 
@FredOverflow AFAIK, RAII was one of the very first features implemented in CFront.
even MFC used RAII and that was produced about the same time as Windows itself, if I recall correctly
certainly long before, say, the STL existed
 
7:13 AM
Maybe it happened like this:
 
> The last remark I'm going to make is about the cover though. I think it's supposed to be two splashes of water that resemble the number 11 (for c++ 11). However, the way they are overlapped on the neat grey band with the title on it totally looks like someone got two dubious stains of some sort of liquid on the cover. Not a good look. Whoever designed this needs talking to.
Paint? I always thought they were two tools from the stone age or something :)
 
rofl
 
It kinda looks like a hammer and a bone or whatnot.
@StackedCrooked That would explain a lot about C++.
"Look Grandma, I made a language feature that allows you to parameterize functions and classes with types and integers." -- "Whoops, I calculated prime numbers at compile time..."
 
lol
 
SFINAE is also a big whoops.
I remember somebody asking that he wanted to check if the function exists, if yes, call it. People were like wtf would you need that for.
Now you can find it in all flavors on SO.
 
7:28 AM
@FredOverflow To me it lookes like bones of Spinal cord. Thus more of a biology book (or archaeology?)
 
Pretty sure it's supposed to be paint if you compare it with the cover of the fourth edition:
 
If the cover would have looked a little prettier than I might just have bought it.
 
The book is already in my shopping basket, but I usually wait 24 hours before I buy something online.
 
Dammit I have the tendency to speak too verbose again.
 
Are you afraid people are gonna react with TL;DR to your messages? :)
lol, there is a book called "The Inmates Are Running The Asylum: Why High Tech Products Drive Us Crazy and How to Restore the Sanity"? :)
 
7:41 AM
High tech products cause a lot of irritation.
I think it would be nice to work with actual objects for a while.
 
@StackedCrooked What do you mean?
 
Always interacting with digital interfaces requires more brain cpu than interacting with real-life objects.
It's getting worse with screen keyboards replacing actual tactile keyboards.
 
Thinking about buying "Masterminds of programming"... here is what I found on amazon:
> Most of these "masterminds" come across as rather provincial, making for an unintentionally hilarious read. Stroustrup can't go much more than a page without complaining about Java. The creator of basic opines that, because all languages are basically the same, if you've learned one you can easily learn any . . . then later talks about how he is trying (and failing) to learn objective-C.
Go Bjarne, go :)
 
I liked that post about Dennis Ritchie's approach to debugging.
By Rob Pike.
 
printf debugging?
 
7:49 AM
Yeah, but mostly standing behind Rob Pike and thinking about how the bug may occur instead searching for something wrong in the code.
 
lol I just googled for "best books programming" and our C++ book faq was the second hit :)
 
There was a brief discussion in the C++ and Beyond video about printf debugging. Alexandrescu said it was a proven method and Herb countered that there are much better tools for that (guess which) :D
 
Wow, Rich Hickey is working on a functional database called Datomic, never heard of that.
@StackedCrooked Visual Studio? :)
 
I usually debug by looking at my code really hard.
 
7:53 AM
But I guess Andrei has to resort to printf debugging. I don't know how advanced the current D programming tools are in that regard.
 
How can a question have both "c++" & "language-agnostic" tag?
 
example?
 
2
Q: Should unsigned ints be used if not necessary?

CeleritasShould one ever declare a variable as an unsigned int if they don't require the extra range of values? For example, when declaring the variable in a for loop, if you know it's not going to be negative, does it matter? Is one faster than the other? Is it bad to declare an unsigned int just as unsi...

 
document<signed> sign(document<unsigned>);
Ok, I might actually like this hip-hop album. Life is good by Nas.
 
What album?
 
8:07 AM
If I can tolerate it playing in the background then it's a good start.
 
Can't watch it here, but I remember NAS from way back in my youth. Is it a recent album?
 
Yep, it's recent
I think.
Are you working on a Saturday?
 
-1
A: How do I define an any-to-any mapping in c++?

ronalchnYou will need to make K and V be special objects. The object will need to include what object type it is. struct { void *pointer; string type; // int type; // this is also possible } Object; The above Object can point to anything. However, it also needs something to say what type it is,...

more down/delete votes please, the amount of wrong in this answer is terrible
 
@StackedCrooked Nope, just chilling in the lounge.
 
@DeadMG This question reminds me of the assignment on "building a symbol table".
 
8:19 AM
lol
 
Any advises for 8085 (assembly) symbol table? I have started coding a Trie from this
believe it or not, I wrote all those lines.
@DeadMG: Instead of down voting the other guy, I am up voting you. I think it is equal.
 
@VinayakGarg Why not do both? :)
 
That would be bogus voting!
@StackedCrooked I worked for 8 hours on Saturday, .... during my internship :(
Please suggest some name for a programming blog (on blogspot). Seems like my creativity has underflowed.
How about "stackoverflow.blogspot.com". It is actually available!
 
8:34 AM
Morning boys
and puppy
@StackedCrooked It's exciting, yes =)
 
8:50 AM
Exciting?
 
9:15 AM
I'm discovering new music today.
According to iTunes I'm into Chamber Pop.
That's a genre..
 
9:38 AM
Poor person is trying to reach God.
 
9:56 AM
Is it okay for boost::serialization to eat RAM while serializing ?
 
Depends on how you wrote it
If you use binary archives and 'default' serializations, I'd say: no
 
first I am populating the structures. which is taking a lot of time and ~3GB memory . then I am serializing.
I see memory usage growing while populating the structure whihc is Okay
 
Oha. Are there inter-relations (3Gb - probably YES)?
 
@sehe yes a lot of interrelated structures
 
Also, what are you measuring? Operating system?
 
9:59 AM
I am just watching in gnome-system-monitor Linux 32bit PAE kernel boost 1.42
 
@NeelBasu Well it will need to keep track of the graph of relations in order to refer to the right 'serialization ids' (not an official term)
 
but I do also see the program eating RAM when serializing also. and it keeps eating RAM and then new operator crashes
with a long crash log.
But Why doesn't it ask for swap space ? when there is insufficient RAM
 
@NeelBasu Oh wait. Gnome Monitor has only 1 column "Memory" IIRC? That is virtual only. So, if you fragment a a bit of heap (which is perfectly normal), it will appear to grow in size, when, in fact the memory has already been freed - just the 'addressible space' has grown
@NeelBasu Ok. Using RAM indicates that the memory is actually being used. Erm. Can you minimize the code (or post it self-contained)?
 
well its not reproducable in that way. Its a text comparisn software and I am feeding two versions of macbeth to it. It will be used for research work for literature department
 
@NeelBasu You use boost serialization for text? I'm guessing... XML
 
10:03 AM
no binary archive
right now What I see in my system monitor is memory usage is increasing.
but population of all structures is complete
its now serializing stuffs
and swap is 0 bytes
 
Oh hey, I gotta go now. Bit of bad news here, it seems
 
Hmm
 
Ell
hi guys
 
10:24 AM
@sehe You may have a see. I've posted it here stackoverflow.com/questions/12226926/…
 
@FredOverflow Ahah, thanks. I knew I could count on you :)
 
Something I did a while ago. Probably a little too convoluted.
I recently discovered that CRTP let's you emulate virtual methods! I felt so stupid that I hadn't realized it earlier. I had used crtp before for things like object counters or leak checkers. But this is something entirely different and quite cool imo.
 
WTF? is this even English???
People write this shit???!!
 
You seem to be continuously surprised by all kinds of oddities occuring on the Internet.
I bought the Logitech Performance MX mouse.
 
It's a meme: Oblivious Tony!
;)
 
10:38 AM
What meme is that?
 
This mous is OK I guess. But there's one aspect that I really like.
 
@R.MartinhoFernandes or "Oblivious Tony" is the meme? :P
 
The scroll wheel has inertia. If you give a forceful spin then it keeps spinning.
It's a nice sound also.
 
@R.MartinhoFernandes Well, having TD&E on my bookshelf must be good for something, right? :)
 
@StackedCrooked so you've completely desensitized to anything you find on the internet?
 
10:40 AM
@TonyTheLion One I just made up.
 
There are some things that I am sensitive to. I like to avoid those things.
 
@StackedCrooked That would annoy the crap out of me.
 
I had a spider in my flat yesterday
had to kill the bastard!
 
10:41 AM
I like spiders, they make webs and catch mosquitoes and stuff.
 
The other things aren't really that bad. These kids on the Internet see an old naked woman and immediately scream NSFL! Silliness..
@FredOverflow It's only if you spin it hard enough.
Now I find myself addictive.
 
@StackedCrooked Not really want to see old naked women myself either, tbh
 
Ell
my mouse wheel has intertia, it's a gimmick
 
@StackedCrooked not sure how to understand that sentence.
 
@TonyTheLion I'm addicted to scrolling.
 
10:43 AM
lol
 
I am practising the perfect spin that will last really long.
 
@StackedCrooked Addictive is not the same thing as addicted.
 
you have fun with that
 
Good point @R.MartinhoFernandes.
I'm probably not addictive.
 
@StackedCrooked For Guinness?
 
class any_ptr {
    void *ptr;

public:
    template<typename T>
    any_ptr(T* ptr) {
        this->ptr = reinterpret_cast<void *>(ptr);
    }

    template <typename T>
    operator T*() {
        return reinterpret_cast<T *>(ptr);
    }
};
I feel evil now
 
Btw those are automatically generated playlists according to your detected preferences.
 
@NikiC You could use static_casts for that.
 
@NikiC Don't make it implicit.
 
(Doesn't really help much, but feels less evil IMO)
@CatPlusPlus Then it becomes the same as void*.
 
10:51 AM
static_cast is the seemingly less evil fried of reinterpret_cast.
But that's just looks!
 
Implicit conversions are evil.
 
@CatPlusPlus Implicit is the whole point of it ^^
 
It's wrong point.
 
4 mins ago, by NikiC
I feel evil now
Duh.
 
@R.MartinhoFernandes Will use that
 
Ell
10:58 AM
what is this for?
 
Bugs.
 
auto_cast
Potentially useful when interfacing your C++ code with Tcl.
 
Ell
auto_cast hmm
 
> error: unmappable character for encoding ASCII
Who the fuck is this compiler kidding?
 
You!
What should I do on this Saturday? Hang around this chat and surf the Internet?
 
11:09 AM
What else?
 
I guesss you are right.
I could go on an adventure. Go outside and meet load of interesting people.
 
Ell
@StackedCrooked do that
 
Last time I dd that my adventure turned out to be a shameful stroll through the city.
 
Sounds fun.
 
Well, I visited a bookstore. That was fun.
He's a real awkward guy. His interviews inevitably lead to uncomfortable silences.
 
11:24 AM
oh cool, there's an exclusive ask-to-gain-access apple chat room here? I guess that desire to be in a "secret club" (or is it cult?) is hard to shake
 
There is?
 

NSChat

Rules → spiff.io/nschat.rules —  Discussion for iOS and OS X ...
 
@jalf Btw, I got the computer architecture book. Looks very comprehensive.
 
@StackedCrooked ah cool
 
Continuations are the GOTO of functional programming?
 
11:28 AM
@StackedCrooked um, are they? :D
 
CPS is just fugly
 
Continuations with Haskell's do-notation do not use CPS.
 
I'm watching the channel9 video with the Clojure dude.
 
@StackedCrooked what did you need it for again? I forgot :D
 
Looking for ways to gain higher throughput in a software tcp/ip stack.
With 10G network cards coming up it gets challenging.
 
11:31 AM
ah, interesting :)
in other news, the Civilization 4 theme still sounds awesome
 
My job is to implement the tcp/ip stack. Kind of fun :)
 
ooh
Sounds like a pain in the ass, but in a good way. Lots of interesting challenges
 
@jalf I prefer Civ4 to Civ5 in pretty much all aspects.
 
I played Civ4 intensely for about a month.
 
@R.MartinhoFernandes yeah, pretty much the same here
well, I think there are some interesting ideas in civ5, but the execution isn't too great
 
11:34 AM
@StackedCrooked Years.
@jalf Yeah.
I haven't tried the expansion yet (damn you Valve, would you put up a special sale already?)
 
I got the expansion to play with a friend. A definite improvement over the base game imo, and we've had some fun with it multiplayer
oh crap, did I just delete a bunch of uncommitted changes?
 
Yes, you did.
 
But Civ4 is a clusterfuck. :(
 
@jalf The biggest challenge is my colleages who developed the previous version (I'm doing a complete rewrite).They want me to implement it in the same way as it was before. I want to rethink the whole concept and challenge all the solutions that have been created in the past. But that hurts the pride of people.
 
11:50 AM
I can imagine :)
 
why do you have your own tcp/ip stack in the first place, btw?
 
@CatPlusPlus It's not! It's awesome.
 
@jalf It's a network traffic generation tool. Mostly used by cable companies, ISPs.
 
@StackedCrooked lol, why would anyone want to do a rewrite that is the same thing?
 
11:53 AM
@StackedCrooked ooh
 
It has been decided that the version number will go to 2.0. Which means that we can break backwards compatibility. This gives the opportunity to rethink a number of things.
 
sounds scary though. From-scratch rewrites tend to end in pain and misery :)
 
TBH the code quality is low. There is very good knowledge about the problem domain, e.g. IPv6. But C++ practices are ..
But I'm trying to improve the situation and I'm slowly seeing progress.
There is also a lot of misinformed ideas about performance. One of my coworkers is very careful to avoid copies.
And chooses list instead of vector..
 
ah, lol
 
The idea of locality isn't really well known.
Also cargo cult.
 
11:58 AM
@StackedCrooked Oh noes.
 
The software director seems to have high hopes on me for bringing change. But I can't really behave in a way like I have authority over the veterans.
But it's not that bad. It's been improving.
 
Yeah, I don't think it's something you can change overnight. Gradual improvement :)
 
@StackedCrooked It's not just that. Putting anything into list means grabbing a new chunk of the heap, which is quite slow (obviously a custom allocator can help, blah blah).
 
just have to keep slugging away at it
 
I love when GPU driver crashes.
 
12:01 PM
@jalf And it feels so much better any time you see some small progress.
 
I'm happy if I am assigned a task where I can write my own code. I don't really like having to interact with the existing code...
 
The Scientology ads on YouTube are really annoying.
 
Scientology ads? Really?
More importantly, why don't you have adblock?
 
Does it block the ads served inside the player?
 
Hm. Not sure. I
have had some ads there.
Apparently the Firefox adblock does a better job there than the Chrome one.
 
12:03 PM
@StackedCrooked I generally don't like the idea of adblockers, because, well, I depend on a lot of sites which are funded by ads. Why would I undermine that? I have flash block to prevent the really obtrusive ads, because screw those, but generally, I figure if they want to show me ads, I can either let them, or stop visiting the site
Scientology ads on Youtube are making me rethink that stance though...
 
@jalf Yeah, that's what I do too.
I don't regularly visit any site that serves annoying ads, so I see no reason to block them.
 
@jalf Strangely enough the biggest challenge up until now has been to find a design that is fast, generic/granular and readable/maintainable by people other than me.
 
Sounds like one of those "pick two" situations.
 
@jalf I don't mind fair advertising.
@jalf The idea of advertising religion seems crazy to me.
 
agreed
it's really impressive how you can start a project with the purest of intentions about simple code structure, flat namespace hierarchy and no globals, and it still takes next to no time to brutally butcher each and every one of those principles...
 
12:13 PM
Sounds like you're talking about something you did...
 
yup
 
(I've been there, btw)
 
Ideally there is sombody on the team throws a raging fit every time somebody messes it up.
 
I just dug up some code I hadn't touched for a year or two
 
@StackedCrooked On my team, that's usually me.
 
12:14 PM
On my team it is also me. But not vocally. Only silent teeth grinding.
 
But when I'm the only one... I can't throw a raging fit at myself. That'd be silly.
@StackedCrooked That doesn't really make a difference, does it?
 
I find it very hard if I've been assigned to rethink the design of something and later somebody is assigned to help me.
It restricts the freedom of trying something else. Because that would break my coworkers code.
I usually end up breaking it anyway and fixing it myself. :P
 
12:33 PM
> If someone points at a thing and says 'that looks like radiation', you are probably looking at a comic.
 
12:43 PM
0
Q: Compiler optimisation against root of evil

tuğrul büyükışıkEverytime someone asks about how his/her functions can be implemented more efficient or made faster, always some people answer with premature optimisation is root of evil (Donald Knuth) . To make a good reference to similar questions about optimisations, can we list the best compilers' capabili...

 
@R.MartinhoFernandes "Reduce simple O(n*n) functions to O(nlogn)(even better while it is valid)," what??
 
How can anyone think that?
 
evil vs gcc
Who shall win?
 
@VinayakGarg It kinda feels like a rant to me.
 
12:53 PM
I didn't read below this!
 
I can't help but read it like "So, you guys are always saying compilers are great and stuff, but can they really do these things? No, they can't. Suck it up and let me do my optimizations."
 
But I always wonder if such questions need a nice answer, before closing.
 
Maybe it's an honest question, but it seems too naïve for the amount of knowledge displayed.
@VinayakGarg I like the last one.
 
rofl
must read all of them
+1 for the last one!
 
1:13 PM
fuck
some prick just votekicked me because he wanted to playwith Cool Toy X and I was using it
as if I need more reasons to hate humanity
 
@DeadMG I thought dogs loved humans.
 
no
this particular puppy has been kicked enough times to learn that lesson
 
13
Q: Why are pointers not recommended when coding with C++

jpartogiI read from somewhere that when using C++ it is recommended not to use pointers. Why is pointers such a bad idea when you are using C++. For C programmers that are used to using pointers, what is the better alternative and approach in C++?

Wrong answer is accepted
 
1:34 PM
LOL
 
LOL
Or maybe Imperio?
 
@TonyTheLion is that coffeescript? :<
 
1:46 PM
hey guys
 
@FlorianMargaine I don't know
@DeadMG hows the job search?
 
don't ask
 
When i make a file stream object, I can send stuff to a text file, I can send an int, double, string, c-string. But when they get sent to the textfile what are they stored as?
 
1:49 PM
@MohamedAhmedNabil as strings?
 
Troll or no troll?
5
Q: I don't understand why algorithms are so special

JessicaI'm a student of computer science trying to soak up as much information on the topic as I can during my free time. I keep returning to algorithms time and again in various formats (online course, book, web tutorial), but the concept fails to sustain my attention. I just don't understand: why are ...

 
@mfontanini are you asking me or telling me ? :)
 
@MohamedAhmedNabil you could try that in a 10 line code snippet, come on
 
@mfontanini i have been trying from yesterday, I kept trying to input and output from text files,, I cant still figure it out
 
@TonyTheLion *thier speling!
 
1:52 PM
@MohamedAhmedNabil what can't you figure out? Write something to the text file and open it with some text editor.
 
@KonradRudolph lol
 
@DeadMG Good answer on the pointers question, I like it. This is probably the most practical explanation.
 
@KonradRudolph I call troll
 
@DeadMG I hope you're not turning into a sociopath.
@KonradRudolph Well, troll or stupid. Take your pick.
 
@R.MartinhoFernandes Or maybe has a genuinely bad teacher who doesn’t bring across understanding. That’s why I’m asking
but it’s weird, because it’s not so wrong, it’s not even wrong
 

« first day (686 days earlier)      last day (4263 days later) »