« first day (635 days earlier)      last day (4314 days later) » 

7:00 PM
@Drise You wasted an opportunity to post this.
 
if( talking.To( rubenvb ) ) { cout << "class with it's member functions" } else { cout << "class with it's methods" };
 
Shame on you.
 
@JimNorton Never say methods. This is C++, we use functions
 
@JimNorton Shame on you! Get rid of using namespace std;!
2
 
i'm sorry thats both wrong
s,it's,its,g
 
7:01 PM
@JohannesSchaublitb s,thats,that's,g
:P
 
@RMartinhoFernandes did I do it on purpose?
 
What sort of separator is that.
 
@JimNorton lose the apostrophes in it's!
 
@Drise Yes, I get it.... just that I've written more Java and C# than C++... so "method" slipped out
 
7:02 PM
@JimNorton Fucntional programming FTL.
 
@rubenvb Yes, my bad....
 
Don't worry, he got it wrong, too.
 
Hmmm, cake.
 
@CatPlusPlus you refer to my separators in the sed script?
 
7:03 PM
Yes, I refer to your separators in the sad script.
 
@CatPlusPlus what about them?
 
brb - googling use of its, it's and its'
 
@JimNorton We could just use Sub and Function indicate void and non-void returns.
 
@JimNorton Just put another t in front and no one will care about the grammar.
 
7:04 PM
you say "its'" if someone is called "its" and you refer to their property
otherwise you would have to say "itss"
 
@Drise Ick..... BASIC like...
 
Awww shit. someone beat em to it.
 
Why is my Internet breaking up.
 
@JimNorton Lol, Vb.
@CatPlusPlus It doesn't love you anymore. It's with someone else likely.
 
user1174868
7:06 PM
damn you diablo 3, the AH i still down do I can't make my money
 
Get a job.
 
user1174868
It is my job
 
user1174868
I make about $1/hour
 
Poor thing.
 
@CatPlusPlus Warp Factor is too high?
 
7:06 PM
 
Lol.
For $1/hour I wouldn't bother even waking up.
 
@CatPlusPlus I wouldn't even bother farting in my sleep. Wait a minute...
 
I'd like to be a gatemage and gate into a bank vault and just be done with it.
 
user1174868
I made about $7/hour when I was in the military and I hated it, so $1/hour for something I like doing is a pretty good deal
 
7:07 PM
@JohannesSchaublitb girls!
 
1
Q: Is it legal to goto out of try block?

Michael KohneI have some code that I've inherited from someone very clever where they like to use gotos to leave the try block, jumping completely around the catch blocks. It definitely works, and I suspect this is legal (I think that the C++ standard says that on exit from a scope, everything gets cleaned ...

WTF.
 
You traded one shitty job for another shitty job. Congrats.
2
 
user1174868
actually I was unemployed for like (well I actually still am) 2 years, and I made way more than when i was in the military
 
True if shitty is in part determined by pay.
 
7:08 PM
@Jordan 7$ an hour but food, losging, etc was paid for, right?
 
user1174868
@SamDeHaan Medical, food, housing was all paid for
 
@JimNorton return (job->isShitty && job->notPaidWell);
 
@SamDeHaan But had to actually get the ass out of bed.
 
If you worked for 24 hours with no weekends for 1$/hour, you'd earn 720$ per month.
 
@CatPlusPlus and be dead.
2
 
7:09 PM
@Jordan But you has to pay for uniforms etc correct?
 
@RMartinhoFernandes truthfact
 
user1174868
@JimNorton Technically we are given an allowance, which is like $40 a year or something but you typically pay more than that by a lot
 
@Jordan Yeah, that's what I heard from a friend in the military.
 
@JimNorton That a reference to that new OSC book? Or is it an older reference I don't know
 
@SamDeHaan Why yes it is! "The Lost Gate"
 
7:11 PM
@JimNorton Nice. Biiiiiiiii(really big)iiiiig fan of the Enderverse, Lost Gate was pretty good too, looking forward to more in that series.
 
No, really, 1$/hour is not a job, it's exploitation.
 
@SamDeHaan Same here.... Enders Game was amazing... I'm listening to the audible version of The Lost Gate now... nearly done.
 
And if you play shitty grind game for 1$/hour, you'll hate it and yourself in 3 months tops.
 
stupid question time:
 
@JimNorton Ah, nice. I was bored (and dutch/cheap) so I just read it sitting in a bookstore when it came out, heh.
 
7:13 PM
0
Q: Initializing a std::map iterator class member

rubenvbI'm trying to do this: typedef std::map<std::string, time_t> my_map; const mymap& some_function(); class bla { private: my_map::iterator current bla(const mymap& m) : current(m.begin()) { } } And it's not working. The somewhat more convoluted real error message is: e...

 
You cannot convert const_iterator to iterator.
Do bla(mymap& m).
 
@SamDeHaan Nice..... I used to have the patience to actually read, but the reading I do is all technical stuff, so to relax now I'd rather listen to a novel.
 
but I'll take a const_iterator if it works
 
@JimNorton Understandable
 
just need to read the values
 
7:14 PM
Then change the type of the data member.
 
why doesn't the decltype work though?
probably gets the function type huh...
 
@RMartinhoFernandes I can already hear the sirens of the goto police.
 
how do you get the type of a function return value?
 
@rubenvb my_map::begin() is not a proper expression.
decltype(std::declval<T>().f())
 
7:16 PM
If C had exceptions, I'd never see a reason to use GOTO
 
Nobody is forcing anybody to use gotos.
 
@RMartinhoFernandes aha. I knew declval would be necessary, just neve knew how to use it.
 
Hmmm
Direct2D doesn't work with DirectX 11?
 
I'd like to be able to force people not to use goto
 
@rubenvb By using decltype on a function call (as opposed to just the function itself).
 
7:17 PM
Stupid CAPTCHA.
 
@JimNorton just #define goto somewhere in a std header.
 
I bothered to make an answer, you better upboat me.
:<
 
@rubenvb haha
 
@JimNorton goto is so constrained in modern languages like C++ I don't think it poses a serious problem. Certainly not any more serious than, say, inheritance. I have seen so much horrible real world code involving inheritance it's not funny anymore.
 
@CatPlusPlus Upboated.
 
7:19 PM
@CatPlusPlus one can see who is in the lounge and who isn't :)
 
I need to make food.
I don't waaaant to.
 
Hmmm. Guess GDI+ is the way to go for UI in DirectX 11
 
my question has to have some duplicate somewhere.
 
@CatPlusPlus Then buy food?
 
7:20 PM
Microwave it.
 
Anyone mind approving my edit?
6
A: Is it possible to read infinity or NaN values using input streams?

user315052Edit: To avoid the use of a wrapper structure around a double, I enclose an istream within a wrapper class instead. Unfortunately, I am unable to figure out how to avoid the ambiguity created by adding another input method for double. For the implementation below, I created a wrapper structure a...

 
Too long.
Also, you shouldn't link to offsite code.
 
I second too long.
That answer's quite unreadable.
 
@rubenvb It's the dude who posted it's fault, not mine. He likes to use Edit: it seems
 
@Drise How did that not get made CW? Did a mod revert it?
 
7:22 PM
@IDWMaster Nah, Direct2D is the new rendering lib.
 
@Mysticial I asked for a reversion, yes.
 
there's less pain to interoperate D2D and D3D11 than GDI+ and D3D11
 
@Drise ah :)
 
and D3D11/D2D interop natively as of Windows 8.
 
@Mysticial drise.tumblr.com/post/26983406424/community-wiki was posted shortly after it became CW.
 
7:23 PM
DirectX, D3D, D2D... wish they'd lose it all and just use OpenGL
 
@JimNorton I don't.
COM is hardly STL, but it's no C shit.
 
@JimNorton DirectX is more that OpenGL offers.
 
@Drise That's good that the mods are willing to do this for us. There's quite a few (excellent) posts that are in danger of going auto-wiki.
 
and also, they offer a lot more than OGL does
 
7:25 PM
Grace Note on August 19, 2011

When you mark a post community wiki on a Stack Exchange site, that means …

this post can be edited by anyone with 100 reputation

this post does not generate any reputation for anyone when upvoted or downvoted

The main advantage of community wiki — more editing — was nerfed when we introduced suggested edits. With suggested edits, anyone, even an anonymous user, can edit anything — so long as another experienced user reviews and approves their edit.

This leaves many wondering — what’s the point of Community Wiki? …

 
In the grand scheme of things, it would be nice if everybody supported one standard for all platforms.... that had the needed functionality.... So a developer didn't need to learn so many graphics libraries eetc...
 
> what’s the point of Community Wiki?
Stealing rep, duh.
 
@StackedCrooked lolwot
he never heard of like, an exception stack trace?
 
How do you get an exception stack trace in C++?
 
explore the SEH chain
 
7:27 PM
Or does Visual Studio generate one automatically?
 
How is that an idiom? I've never seen that.
And it looks stupid.
 
VS can do it automatically (when you're debugging, of course).
you can set it to break on exception, and then you get the whole call stack
 
If all primitives are RAIIfied, then there's no need for silly things like that.
 
 
@CatPlusPlus Indeed.
 
7:29 PM
@Drise Yeah, I've seen that. I'd suggest that they remove the auto-wiki status. And instead, raise a flag for "too many edits" on a post. Since the point really is to prevent people from abusing edits to bump the question to the front page.
 
I dunno if GDB or LLDB offer similar things but they should do
 
gdb has catch throw
Which catches all exceptions though.
 
@Mysticial So that's what it's there for...
 
Putting a breakpoint on constructor of exception is another way.
 
GDB will break on top-level exceptions.
 
7:29 PM
@Drise Yeah.
 
No need to do anything.
You can use tcatch throw to pinpoint nearest throw, AFAICT.
 
@Drise Actually, the current auto-wiki situation doesn't prevent someone from abusively bumping a question to the front page.
 
But that's not very useful.
 
If I have a container ct that is containing some type of struct and then do for(auto c: ct), will c automatically be reference to the object? It's not making a copy, right?
 
7:32 PM
It's a copy. Why would it be a reference?
If you want a reference, use a reference. auto& or auto&&.
 
Because that's implicitly usually what you want
okey
 
Robot will tell you which one is better.
I don't remember.
 
thanks
 
C++ has value semantics. It defaults to values.
 
@JimNorton now that I think of it, make sure to call g++ -std=c++0x and change all/most pointer arguments to (const) references. And make your code const correct. C const sucks.
 
7:33 PM
So, no, it won't magically guess you want a reference this time.
 
@rubenvb Will do... thanks for the tip...
 
@ManofOneWay Same rules as template <typename T> void f(T)
 
user1174868
I think I just got a stack overflow, i.ytimg.com/vi/aA8OOJjjvjU/0.jpg
 
Ugh, I'm pissed at the lack of enthusiasm for C++11 where I work.
 
auto is a value; auto& is an lvalue reference; auto&& is a reference, any reference.
 
7:36 PM
Would it make any sense to copy a pointer? for(auto predecessor : current_block.predecessors) instead of for(auto &predecessor : current_block.predecessors), if all I want to do is to access stuff within the object that the pointer is pointing to
 
323
A: Strangest language feature

josefxThe weird things C++ templates can be used for, best demonstrated by "Multi-Dimensional Analog Literals" which uses templates to compute the area of "drawn" shapes. The following code is valid C++ for a 3x3 rectangle #include"analogliterals.hpp" using namespace analog_literals::symbols; ...

^ I stumble upon that once or twice a year and always fall in love with it again :)
 
@ManofOneWay If it's a pointer, a value is ok.
 
int a = 1; auto &&x = a, &&y = +a;
^ error
why is this!?
 
@RMartinhoFernandes Sure, but would a reference to that pointer be equally fine?
 
@JohannesSchaublitb auto can only deduce one type, but x should be an lvalue reference and y an rvalue reference.
 
7:37 PM
Yes.
 
will it work if i say auto &x = a, &&y = +a; !?
 
Honestly, I have no idea. Try it and tell us.
 
You already tried it before asking, didn't you?
 
I love programming; If you're not sure, the worst that could happen is a (several hundred) compile error(s).
 
7:39 PM
@FredOverflow i didn't try anything :(
 
Not really.
 
191
A: Strangest language feature

Chandra PatniIn Java: int[] numbers() { return null; } Can be written as: int numbers() [] { return null; }

Oh, I just learned something new about Java. Who would have guessed?
 
@FredOverflow Is that really a feature?
 
Incredibly useful.
 
7:40 PM
> learned something new about Java
forget it
 
@ManofOneWay It's a part of the Java language that I wasn't aware of.
 
It gets better.
 
74
Q: Weird "[]" after Java method signature

Johannes Schaub - litbI looked at some Java code today, and I found some weird syntax: public class Sample { public int get()[] { return new int[]{1, 2, 3}; } } I thought that can't compile and wanted to fix what I thought was a typo, but then I remembered the Java compiler did actually accept it! Can some...

 
You can mix both styles.
int[] numbers() [] { return null; } // returns an int[][]
 
@RMartinhoFernandes I thought robots were flawless. Is there a software update I'm missing?
 
7:41 PM
Awesome!
 
actually, the java code i looked at was the java spec :)
 
That makes you the only person on this planet who actually read Java spec.
 
Also Explorer crashed. I think I'm running out of memory again.
 
I like this one: Making new friends.
 
7:43 PM
What is better?

using namespace std;

or

std::cout etc

or

using std::cout;
using std::cin;
using std::endl;
 
std::cout.
 
@JimNorton std::
 
using namespace is never good.
 
@CatPlusPlus Erm.
 
7:44 PM
@CatPlusPlus It spreads like a virus
 
It's an actual tool now. :S
I've used it more than once.
 
@CatPlusPlus For shortening it could be good?
 
It's not for beginners. :.
 
And the reasons for preferring std::cout etc?
 
7:44 PM
101
Q: Why is 'using namespace std;' considered a bad practice in C++?

ManaOkay, sorry for the simplistic question, but this has been bugging me ever since I finished high school C++ last year. I've been told by others on numerous occasions that my teacher was wrong in saying that we should have using namespace std; in our programs, and that std::cout and std::cin are m...

 
soneone created USING(std, (a)(b)(c));
 
11
Q: Is using namespace..like bad?

Sauron Possible Duplicate: Why is 'using namespace std;' considered a bad practice in C++? Every time I use using namespace std I always get that "thats a terrible programming habit". Now I'm graduating this December with my B.S. in C.S. but I don't claim to know everything, but no on...

 
@JimNorton global namespace clutter
 
Not cluttering namespace?
 
7:44 PM
and it is equivalent to using std::a; using std::b; using std::c;
 
I was thinking more of namespace ip = boost::asio::ip;
 
using namespace fuck;
 
@JimNorton using namespace std defeats the whole purpose of namespaces. It's so much nicer to see std::some_strange_identifier instead of just some_strange_identifier, because then I immediately know it's part of the standard and I can look it up and what not. Also, you don't get accidental naming collisions which, when mixed with overloading, can be extremely nasty.
6
 
@FredOverflow +1 upvotes.
 
7:48 PM
@FredOverflow got it..
 
@StackedCrooked A goto disguised as a macro? Damn, it's like they really wanted to forfeit their souls.
 
@StackedCrooked Known uses:
 
@sbi had an excellent answer where the OP was accidentally calling std::abs instead of his own abs or something because of using namespace std. Can anyone find it? It was a real eye-opener for me.
 
@FredOverflow stackoverflow.com/a/4043963/868546 Likely an equivalent.
 
@StackedCrooked reminds of some Qt stuff
 
7:50 PM
9
A: Ambiguous overload call to abs(double)

sbiThe header <math.h> is a C std lib header. It defines a lot of stuff in the global namespace. The header <cmath> is the C++ version of that header. It defines essentially the same stuff in namespace std. (There are some differences, like that the C++ version comes with overloads of so...

Ok. Time to tackle the UCD.
 
@RMartinhoFernandes Hm... no, I think it was something else involving the distance between two points or something. Oh yeah, std::distance, that rings a bell.
 
@FredOverflow Hey, that one is what you asked for. I'm good at finding stuff, not guessing.
2
 
26
A: how to use iterator in c++?

sbiThat your code compiles at all is probably because you have a using namespace std somewhere. (Otherwise vector would have to be std::vector.) That's something I would advise against and you have just provided a good case why: By accident, your call picks up std::distance(), which takes two iterat...

@RMartinhoFernandes That's the one, sorry :)
 
@RMartinhoFernandes Guessing would be NP hard, robot can't handle that.
 
@RMartinhoFernandes The robot only has find(), not predict()?
 
7:54 PM
@RMartinhoFernandes ...says the robot who invented std::do_what_i_want? :)
room topic changed to Lounge<C++>: Thou shalt prefix thy standard library names with std:: [brainfuck] [c++] [c++11] [c++-faq]
 
@FredOverflow Was it also him who asked for gcc -fdo-what-i-want?
 
@Drise Oh, maybe I mixed that up, sorry.
 
@Drise No.
Apr 11 at 17:54, by R. Martinho Fernandes
std::do_what_i_want(std::guess_the_arguments_while_you_are_at_it());
 
right lol :)
 
@RMartinhoFernandes Yes.
yesterday, by R. Martinho Fernandes
How do I convince GCC to just do what I want?
yesterday, by Fanael
@RMartinhoFernandes -fdo-what-i-want
 
7:58 PM
i haven't yet understood what "hangouts" are for on google+
 
Oh. I didn't ask for that.
 
@JohannesSchaublitb hanging out, mainly
 
@JohannesSchaublitb Do you understand what a "hangout" is in real life?
 
@JohannesSchaublitb Hanging out? (IHNIWIATA)
 
7:59 PM
Ah.
 
@RMartinhoFernandes Only one google result for IHNIWIATA.
 
I have no idea what I am talking about.
 

« first day (635 days earlier)      last day (4314 days later) »