« first day (587 days earlier)      last day (4360 days later) » 

3:00 PM
Try a hoof smith
 
Ell
@DeadMG just thought - how are the primitives drawn? they don't have an OnPaint method so does the renderer have to check the class of the Drawable?
 
@Ell the scenes have lists of them.
 
Ell
the primitive stuff?
 
yep
check in both 2D and 3D scenes- they have Draw methods
 
Ell
I dont like that :L Its enough reason for me to go my approach - the hybrid approach - primitives are DrawRectangle, controls are implicit
 
3:02 PM
you just don't like it, and I forgive you
 
Ell
I don't know why I don't like it :L I just don't :S
if it makes you feel better, I will write Line, Rectangle and Ellipse classes that wrap the primitive calls :D
 
why would you care about me feeling better? it's your code
your loss, in my opinion
 
Ell
I don't really care about you feeling better :L because I know that the knowledge of me having written those classes wouldn't make you feel better at all
I just think that is the best of both worlds
 
Ell
3:16 PM
for my Colour class, should I use int R, int B, int G or char R, char B, char G? Or float R, Float G, Float B etc. ?
 
Or just doing a little extra research? StackOverflow is not a substitute for thinking. — R. Martinho Fernandes 54 secs ago
 
Ell
of course it's a substitute for thinking!
 
@RMartinhoFernandes Oh come on! Not even a little!?
 
hello
guys
how are you
 
ratzip ... that question is bad :)
 
3:19 PM
yes
I know
just when we were reviewing code today, someone said this concept
so I need to find it out
 
"Native pointer" is a misnomer, twice as much when dealing with C++.
 
If you're using C++/CLI, then it makes sense to have "native" pointers and "managed" references.
 
@Ell Use float.
 
Otherwise, I think they just mean "raw pointer".
 
I am standard c++
 
3:21 PM
If you're using C++/CLI, you're weird.
 
Managed pointers are ref counted and garbage collected accordingly. But there are also "native c++ pointers" that are called smart pointers and those count refs too.
 
or doing interop
 
what you mean
 
well, technically, C++/CLI is still good for that
 
He means C++ doesn't generate garbage so why need a GC :) ?
RAII is my Garbage Collector.
 
3:22 PM
c++ does generate garbage
right?
 
@CatPlusPlus We use it a bit here. Many of the stuff that's used by the engine is made in C++, and sometimes we have to access it from the tools, which are written in C#. So we wrap those things in C++/CLI.
 
If 10k+ users want to laugh at me: meta.stackoverflow.com/a/133652/167757
@ratzip not unless you make mistakes
 
@ratzip Nope, c++ doesn't generate garbage.
 
C++ is garbage.
 
@ratzip It used to, kinda. Now, nope. As @CatPlusPlus says, it IS garbage :P
 
3:24 PM
@ratzip "garbage" refers to memory you can no longer reach. In C++, we call it a "memory leak".
3
 
sorry, my question make people feel gross
 
really sorry for that
 
Thou shalst ne'er be forgiven!
 
yes, but c++ will have the memory leak
 
3:25 PM
Nope.
 
@ratzip if it leaks you're doing it wrong. Ideally use RAII and avoid constructs which even have the potential to leak
 
what is this c++/cli?
 
Correctly written C++ is unlikely to have memory leaks.
 
Just use RAII and smart pointers, you don't even have to touch "new".
 
Ell
...delete?
 
3:26 PM
Delete ? What is that ^^?
No sorry I don't write delete, no need.
 
class foo{private: foo(); foo(const foo&) = delete; foo& operator=(const foo&) = delete; public: foo* get_instance() { static foo* f = nullptr; return f ? f : (f = new foo); } };
 
Well, unique_ptr. shared_ptr still has an opportunity to leak.
 
@CatPlusPlus O_o ?
 
the rule in this company is we must use constructors
 
Circular references.
 
3:27 PM
@CatPlusPlus Wuuuut ?
 
@CatPlusPlus shared_ptr I can see for circular references, but unique_ptr?
 
unique_ptr is fine.
 
new unique_ptr<int>(new int(1));
 
@ratzip It has "nothing to do" with constructors.
 
Well, unless you use release.
 
3:28 PM
@Collin make_unique<int>(1)
 
@DeadMG wut?
 
Write a make_unique function first.
 
There is one by Herb Sutter
on his blog
 
@RadekdaknokSlupik I was trying to come up with how a unique_ptr might leak
 
I use that one whenever i need to .
 
3:29 PM
@ScarletAmaranth we use constructor to init variable
 
template<class T, class... Args> std::unique_ptr<T> make_unique(Args&&... a) { return std::unique_ptr<T>(new T(std::forward<Args>(a)...)); }
 
@Collin foo(std::unique_ptr<T>(new T), std::unique_ptr<T>(new T)).
 
@Collin Give it a deleter that doesn't delete anything. struct del { template<class T> void operator(T*){} }; std::unique_ptr<int, del> a(new int);
 
Execution can go like this: new T, then new T, then the std::unique_ptr ctors.
If the second new throws, the first leaks.
 
@RMartinhoFernandes Your answer on that meta question is excellent.
 
3:30 PM
Thanks.
 
template<typename T, typename ...Args>
std::unique_ptr<T> make_unique( Args&& ...args )
{
return std::unique_ptr<T>( new T( std::forward<Args>(args)... ) );
}

This one is from Herb's blog. Pretty much what @RadekdaknokSlupik said.
 
@jalf Remember how you were saying that + for string concat is really bad and unintuitive?
 
@RMartinhoFernandes in fairness though, that's hardly the fault of unique_ptr itself
@DeadMG Yes? Well, I don't think I said "really bad", did I? But yeah, I certainly think it's not ideal
 
I realized that it actually does have a mathematical similarity
for example, matrix addition
 
did you find some Ultimate String Authority who disagreed with me? ;)
 
3:31 PM
you can add matrices but not subtract them
 
@RMartinhoFernandes Really? I would have figured it would have to completely evaluate one argument before doing them all piecemeal
 
@DeadMG What?
You can subtract matrices.
 
O_o you can't subtract matrices o_O ?
 
I don't know about you, but I can subtract matrices just fine ;)
 
@Collin Nope.
 
3:32 PM
o rly? cause I looked on Wiki and there's none listed
 
I can!! :)
 
maybe they just had it as implicit
 
That meta question is more controversial than I expected
 
order of which unique_ptr was created first would be undefined, but I'm surprised it's allowed to do that much re-ordering.. interesting
 
oh well, ignore me then
 
3:32 PM
A - B = A + (-1)*B.
 
anyhow, there are memory leak in c++
 
@ratzip Nope, tehre are not.
 
Don't take unique_ptrs by argument. Doesn't make any sense anyway.
 
@ratzip Only if you do it wrong
 
@ratzip Only if you don't know how to code C++.
 
3:33 PM
It's not like in java that garbage is inevitable.
 
what you mean by doing it wrong
 
@ratzip there might be bugs in your program, but that's a flaw of you/your code not a flaw of C++
 
Lol why would subtracting matrices be impossible.
 
Because you can write c++ code that does NOT generate garbage.
 
@ratzip it's your issue, use RAII properly and you wont have leaks
 
3:33 PM
@Collin That's why make_unique is so important. It makes the compiler won't interleave things like that.
 
nevertheless, I'm sure there are other examples that'd work. There are probably cases where addition is well defined and subtraction is not. Problem with strings is that there's no universal definition of what addition means. Most people would expect it to concatenate, but it could also try to parse the values as ints, and add those. Or it could treat both as char pointers, coerce both to integers, and add those.
 
@RMartinhoFernandes no problem with make_unique, right?
 
My objection is basically that "concatenation" and "addition" are not necessarily the same operation
 
@jalf I think that only PHP is stupid enough to do the convert to numbers thing
 
3:34 PM
ok, but if we do not use RAII?
 
@ratzip Then you're a moron and your leaks are your own fault?
 
Then your code is buggy.
 
You fail at life. :)
 
@RMartinhoFernandes if the second one throws, the first one will be destructed, not?
 
3:34 PM
the language provides that feature for a reason
 
@DeadMG I'm sure there are others. But yeah, I'm not disputing that +-as-concatenation is by far the most common
 
@RadekdaknokSlupik Read dat article i linked to.
 
but the whole company do not use RAII
 
anyway, I have nothing new to add to the debate, as it turns out, unfortunately
 
3:35 PM
@ratzip leave that company.
 
The whole company fails.
 
@RMartinhoFernandes good meta post
 
Why + for concatenation is bad?
 
Why the hell do you use C++ then ?
 
@ratzip Then the company is a moron and the leaks are their own fault.
 
3:35 PM
@DeadMG :)
 
Might as well go Java ...
 
Given foo(make_unique<T>(), make_unique<T>()), the compiler cannot partially evaluate a make_unique<T>(). Either it evaluates it in full or not at all. There's no chance to break stuff.
@RadekdaknokSlupik Yes, no problem.
 
@MooingDuck huh, why 10k+?
 
@jalf TCL also does it as an integer addition (inside an expr statement, outside of it it's just wrong)
 
@CatPlusPlus Depends on your definition of "bad". I think it's a case of operator abuse
 
3:36 PM
I don't see anything wrong with it, really.
 
@RMartinhoFernandes another reason not to ever use new directly. :)
 
but it's become so common that we kind of accept it as "that's just how it is".
Still the + operator is for addition, not for concatenation
 
@jalf adding two strings together is well-defined in my book
 
@jalf what do you want for concatenation then? <<?
 
+= is for concentation
 
3:36 PM
@MooingDuck I see, 10k+ on meta. No chance in hell :)
 
@bamboon Thanks. There's a cargo cult programmer in the comments that didn't like it, though.
 
@CatPlusPlus well, it's not as big a deal as I make it sound when trying to sway @DeadMG. ;)
 
@johnathon + is too.
 
@RadekdaknokSlupik Y U NO reading the article :P ?
 
@johnathon concentation?!
 
3:37 PM
@ScarletAmaranth I am reading it. I have two monitors and two eyes!
 
ok, see you guys
 
@sehe with the std::string yea.
 
bye
 
good to talk to you guys
have a nice weekend
 
@RadekdaknokSlupik I don't care. Could be . , or concat() or perhaps a previously unused operator, like, oh, say, #. It doesn't really matter. I'm not talking about C++ or any other specific language
 
3:37 PM
@RadekdaknokSlupik GOOD! :)
 
just the general concept of string concatenation
 
@johnathon concentation is not a word :)
 
do not stay in front of laptop always
 
@sehe it's deleted
 
@ratzip same!
 
3:38 PM
@sehe Ooh it is. It is a very funny word ^^
 
bragger
 
strcat and strdog.
11
 
@sehe i say a lot of things that are not words sehe , the idea is getting the communication across
 
@CatPlusPlus woof woof
 
@CatPlusPlus exactly
 
3:39 PM
@johnathon the idea is that that works two ways :)
I just communicated something else. (receive the message... receive the message...)
 
@RMartinhoFernandes it's meta what do you expect
 
For some odd reason I always think that Herb Sutter has no eyes.
 
@RadekdaknokSlupik Too much meth ?
 
I don't do drugsâ„¢.
 
What about non-trademarked drugs?
 
3:41 PM
@ratzip sneak up on it from behind sometimes
 
@RMartinhoFernandes Those are also drugs.
 
@RadekdaknokSlupik Do drums instead
 
@RadekdaknokSlupik STL only has one. I'm pretty sure Herb Sutter has a whopping two...
 
@jalf WTF TWO EYES? THIS IS MADNESS
 
whopping pairs... mmm
 
3:42 PM
@DeadMG Yeah, so extravagant
 
" Minecraft sells 6 million " ... oh sweet golly.
 
you'd think the grew on trees!
 
Arrgh, is there a non-rude way I can tell the people arguing in comments to my answer to STFU?
 
@RMartinhoFernandes I wouldn't bother, but that's just me
 
@DeadMG But it's all over my inbox!
 
3:43 PM
@RMartinhoFernandes Yeah, you say : Shatafakap mofos. Guaranteed to work.
 
@RMartinhoFernandes no, I meant, just be rude
 
@RMartinhoFernandes Bring them here.
 
3:44 PM
@sehe I read that title as "dog ejaculation". D:
 
@RMartinhoFernandes Mod flag
 
@EtiennedeMartel No, honestly, I have no interest in the discussion. I don't care if they have it, I just don't want to hear about it.
 
@RMartinhoFernandes sorry I'm out now
 
@sehe Oh, good one.
 
weehoo.
 
3:45 PM
Ask @DeadMG how to do that. He's good at those things. :P
 
@RMartinhoFernandes I should have quit a few comments back
 
Emscripten now supports LLVM 3.1, in case anyone felt a compelling need to compile his C++11 code down to Javascript over the weekend ;)
 
@awoodland SO should have a "don't notify me anymore" feature.
 
@RMartinhoFernandes Yeah, but if you bring them here, we can crush their egos and turn them into empty shells.
 
3:47 PM
Because.... IT'S WAY COOL.
Y U COMPLAIN ALL DAY about the heat, and then don't see the relevance for COOLNESS?
 
@sehe I've been playing with that recently. It's great, now I can use WT and have the exact same validation functions server side and client side
 
My lexer is done. Not a single regex given.
 
Because regexes are too mainstream ?
 
@awoodland Yeah, I think it's cool. However, since I shun web applications, haven't found a proper use for it. It is one hell of a nice hammer though
 
Because they suck.
 
3:50 PM
@Drise right, let's keep them in ignorance. — R. Martinho Fernandes 3 mins ago
 
@RadekdaknokSlupik Do you mind slapping yourself ?
 
I feel bad having to point out things like this.
 
@ScarletAmaranth They're not a performant solution for large-scale lexing/parsing
 
@ScarletAmaranth no, only stabbing myself in the eye with a fork.
 
@sehe Yeah, but that doesn't make them suck. It's a really elegant way of doing lexing.
 
3:51 PM
No, it's not.
 
@RMartinhoFernandes I resisted replying to the next reply from that with something sarcastic about how they might learn something new
 
@RadekdaknokSlupik So you basically loop trough the string and tokenize based on some rules :) ?
@RMartinhoFernandes Yes it is :)
 
The really elegant way of doing lexing is with monads.
 
@sehe the combination of WT (C++) and Emscripten has made me think about a toy webproject in C++ again
 
It seems C++11 is this embarassing and dangerous thing that we should keep away from the newbies at all costs.
 
3:52 PM
@ScarletAmaranth yeah. Wait.
 
In other news, Dragon docked.
 
@RMartinhoFernandes that's not his point and you know it. I agree with you about the Q/A, but he raises many valid points.
 
@RMartinhoFernandes what we really need is more answers with perl scripts to generate overloads to simulate variadic templates
 
@MooingDuck Who? Dirse?
 
@MooingDuck No he didn't.
 
3:53 PM
@RMartinhoFernandes The opposite is true. To my joy, I don't get negative feedback on using C++11 constructs in answers these days. But then again, I shun the 'pulp' questions. No more or that stuff
 
@RMartinhoFernandes oh, not Dirse. I was reading Almo's comments
 
Drise - and why assume she's a he
 
and I've learned quite a bit from the "oh if you have C++11 you could do it with X" type parts of answers - more than I've learned from the plain old C++98 stuff lately
 
@awoodland Becase c++11 is teh owsum :)
 
BTW, I'd be careful she builds missile systems
 
3:55 PM
@sehe I never got negative feedback for mentioning C++11. The trick is to use common sense and explain what your answer is.
 
and questions that make you think "ooh there ought to be a neat solution to this now" are really interesting too
 
@sehe I always just provide both version if they're very different.
 
@RMartinhoFernandes I tend to provide c++03 answers, with either c++11 alternatives or providing a demo program using c++11
 
Obviously, if your answer consists of nothing but a block of code, that's a different matter.
 
in my opinion, if you're a professional, then it's your job to know C++11 by now
and if you're not, then there's no shame in asking
 
3:57 PM
Ahoy, mateys.
 
@MooingDuck Me: Not always:
2 days ago, by sehe
@Michael Use bind. C++03 or C++11? Boost or non-boost? By the way: http://stackoverflow.com has a search box, and this is a vFAQ
2 days ago, by sehe
@Michael You still need to answer the questions. I can write out the incantations in any of the four permutations there, but I won't waste my time if you don't specify the target language/libs
That's mainly because bind_mem_fun_ref binder_1st and the lot are a pain in the ass. I was willing to do Boost Phoenix c++03 answers, but not plain old STL
 
I always forgot if 1st meant the placeholder or the arugment went first
 
@ScarletAmaranth Here it is‌​.
Warning: I have written the code, and therefore it is a mess.
 

« first day (587 days earlier)      last day (4360 days later) »