« first day (1017 days earlier)      last day (3932 days later) » 

1:00 PM
If you're in a single thread, why can't you figure out a well-defined lifetime?
 
@R.MartinhoFernandes outsourcing?
 
@sehe why should I ever consider something that's 10 years old?
I mean, if not explicitely forced to
 
@R.MartinhoFernandes I never heard people talking about bad or good kind of lazy people
 
C++03 compatibily has to be thought of when you need, well, C++03 compatibility
 
generally lazy people are just lazy
 
1:01 PM
but since you don't always need it, you shouldn't think about it prematurely
 
@Telkitty猫咪咪 Laziness as a virtue gives you more efficiency. Laziness as a flaw gives you less efficiency.
 
user784668
Premature featurization!
2
 
@Fanael AKA YAGNI
 
@R.MartinhoFernandes I don't think that's too different in a multithreaded scenario. In sane threaded code, you'd still be able to have well-defined lifetime. Having multiple threads use the same resource, and no guarantees about when each of them will stop using it, or in which order they'll release it seems scary to me
 
@TonyTheLion is this news, or where you just not thinking of that?
 
1:02 PM
~Premature Code Ejaculation~
 
I'd say use cases for shared_ptr are fairly rare whether you have one or more threads
 
@R.MartinhoFernandes what if you wish your code to be threadable, but are not currently using it as such? #devils-advocate
 
@thecoshman YAGNI
 
@thecoshman oh I didn't think of that. Damn
 
@R.MartinhoFernandes which kind of lazy person is cat++?
 
1:03 PM
@thecoshman How's that a single-threaded scenario?
 
@R.MartinhoFernandes touché
 
If you design for multiple threads, it's a multi-threaded scenario.
 
@BartekBanachewicz "I will use this in multi-thread, just not right now" you ARE going to need it, just don't need it right now.
 
That pretty much means you need it now.
Either you know you need it or you don't.
 
1:05 PM
and stop just saying 'YAGNI' at everything. Whilst in principle yes, only develop for what you need right now, but do not work so blinkered that at the slightest deviation, everything falls apart.
 
@BartekBanachewicz mmm. ITT Bartek fails at simulating pedobear
 
@R.MartinhoFernandes Well I never.
 
You can't counter argue YAGNI with "what if you will need it?"
 
@thecoshman no, moving to multithreaded is not a "slightest deviation"
@sehe :S
 
@thecoshman How do you design blind?
 
1:06 PM
@R.MartinhoFernandes no, I am countering it with "there is a strong chance we will need it"
 
user784668
@thecoshman so if you need it, then you need it, duh
 
@R.MartinhoFernandes blinkered != blind
 
@thecoshman I meant what I wrote.
You cannot design for requirements you don't know.
Do not treat programming as a dice game.
 
Ell
Does performance matter if your code runs fast enough? ie, if your code works but is clearly doing something suboptimal (ie 3 loops which could be transformed into 1), should you still refactor it?
 
@R.MartinhoFernandes Because you have a class that sometimes owns, sometimes doesn't own a dynamic resource and you don't want it to be a template/derive from a class template etc. You can simply use shared_ptr for convenience. I truly don't always mind
 
1:08 PM
@Ell It depends.
 
@sehe Then why do you mind that its implementation uses locking?
 
@MartinJames in case you missed it: stackoverflow.com/questions/16489772/…
@R.MartinhoFernandes I never said I did. That was Martin James
 
13 mins ago, by sehe
I know I'd have liked thread-awareness to be a "policy" on shared_ptr, though
 
@R.MartinhoFernandes of course not. Equally, if you know that there are plans for a feature coming up that are not yet finalised, consider it in your current design. If it is a bit harder to accommodate for it now and trivial to then add that feature, I would do it. If it turns out that feature is not added, of well, I spent a bit more time working on adding it. Of course, I am talking about when you know such a requirement is coming, just not finalised. I am no way advocating adding features, just encase.
 
@Ell that's a matter of resources willing to be spent on that
 
1:10 PM
@Ell it's fast enough
 
(Also note how your use case is basically an abuse, as there's no sharing of ownership; hard to convince people to support such a use case)
 
@Ell if you have spare resources allocated for the project, you might want to improve performance
everything in software development is a matter of cost and cost efficiency
 
Ell
Right
 
@R.MartinhoFernandes That's something else. I'd have liked the threadawareness to be 'explicit' (pay-for-what-you-need). Whether or not it uses locking or lockfree primitives is irrelevant. Then again, I don't this all being not available for precisely the reasons you state.
 
@thecoshman But that's "you need it". That doesn't apply to YAGNI.
 
1:11 PM
@Ell by the definition of "fast enough", no. if performance still mattered, it wouldn't be fast enough. (unless performance mattered for other reasons than pure speed. The app could be fast enough for your users, but in taking more CPU time than necessary, consume too much battery life)
 
@R.MartinhoFernandes no, you do not need it at all. You might add support it for it expecting to need it, but then it turns out your don't. You did not need to spend the extra effort adding that support.
 
@thecoshman Well, turns out that advocating against "adding features, just [in case]" is YAGNI.
 
@Ell that being said, most of software tends to go after more features first, only to look at performance way later (which I don't think is that good of an idea)
 
@thecoshman WTF?
 
Here's a novel idea: just share a shared_ptr<T> const &, or better yet, a pointer to one (trolololol)
 
Ell
1:12 PM
@jalf Right okay, I think I was thinking about the cpu time thing
 
@R.MartinhoFernandes side note. oooooh, so that is what the square bracket thing is.
 
You add a feature but you don't need it and you did not spend extra effort?
Does not compute.
 
@R.MartinhoFernandes it's kinda hard when he's trying to use one invalid argument over and over // cc @thecoshman
 
Oh joy, a C badge
 
Sell the feature to PHP programmers
 
1:14 PM
Just what I wanted for Christmas ;-;
 
@Ell set some requirements. How fast is fast enough? How much cpu time is too much? How much drain on the battery is too much? Then it becomes a simple binary choice: your app is fast enough because it satisfies the requirements you set out
 
@Magtheridon96 lol i have a mere 43 in
 
@sehe Are you invoking Godwin's law for programmers? (ie mentioning PHP)
 
@R.MartinhoFernandes Do you dictate your requirements 100% your self? Or do they come from someone/where else?
 
@TonyTheLion :/
 
1:15 PM
:?
 
??/
 
@thecoshman I don't see how that changes anything.
 
??!
 
Changing requirements is bread and butter and YAGNI is all about that.
 
Soon.
 
1:16 PM
@BartekBanachewicz Mine are pathetic, I only have substantial points in the C and C++ tags /o/
 
Using Ramdon Filing or sequential ? Show us your code or structure of reading. — Shumail92 45 secs ago
^ I don't even
 
@Magtheridon96 i have C++ and OpenGL so...
 
I'm not sure what I have anymore. :D
 
The rest aren't even decent
arrays, strings, what the fuck
 
user784668
GCC doesn't support atomic_* on shared_ptr, does it?
 
1:17 PM
IF someone told you to implement a feature and two weeks later comes over and tells you to ditch it, it's a management issue. You implemented what you needed. If you wasted time implementing a feature that was never asked for, it's your problem.
 
@sehe I think he means reading randomly throughout the file, or sequentially from beginning to end.
 
@R.MartinhoFernandes If your requirements come from elsewhere, you will know what you have to do. But you will also (potentially) be aware that other new requirements will come at some stage. I am saying that if whilst working on one feature, it would have to change to accommodate a new feature that is still being decided if it will be introduced, and likely will, it is worth spending extra time to make that later feature easier to implement.
 
@Magtheridon96 I actively worked to get C++11 on top of C :P
 
@R.MartinhoFernandes not what I am saying though.
 
@thecoshman Are you saying you should guess at what the new features will be?
 
1:18 PM
Hm.
 
Then a big fat no.
 
@BartekBanachewicz That'll probably never happen for me, I have a lot to learn, and people are asking way more C and C++ questions than C++11 questions ;-;
 
Maybe I should use '\0' as the trigger for my default glyph to mean "there is no default glyph"
Or maybe I should just use optional<Glyph> or something.
 
user784668
@ThePhD yes
 
@Borgleader "Ramdon Filing" - yeah, I can guess that too. However, I don't even w.r.t. the quality of the comment
 
1:20 PM
@R.MartinhoFernandes no. I am saying that you are being informed of what upcoming features you might have to introduce, and know what is very likely (read, almost certainly) going to be added. So yes, you might end up wasting time because you tried to accommodate something not yet decided on, but most of the time, it will pay off.
 
@thecoshman That's what I said above.
 
@sehe w.r.t?
 
with respect to
 
@Fanael Okay. :D
 
They tell you "implement X and consider Y will be coming". So you implement X taking in consideration that Y will be coming.
You needed it at the time.
 
1:21 PM
btw (NO HATING)
> We have been doing some fairly close analysis and it comes down to a few additional microseconds overhead per batch in Direct3D which does not affect OpenGL on Windows. Now that we know the hardware is capable of more performance, we will go back and figure out how to mitigate this effect under Direct3D.
 
YAGNI is not about predicting the future.
 
that's actual quote, if anyone is interested
 
@R.MartinhoFernandes except feature Y might not come, it is just likely too
 
@thecoshman Doesn't matter, you still needed to design for it.
 
Ell
1:23 PM
@BartekBanachewicz is that from the L4D2 port?
 
@R.MartinhoFernandes no you didn't. you only needed to design feature X. That is all you are currently being asked to get delivered by such a time.
 
@thecoshman YAGNI means that if you don't need it, don't do it, nevermind on how likely it is
 
user784668
@BartekBanachewicz like, Direct3D user-mode is more strongly separated from the kernel-mode driver for whole-OS stability?
 
@Ell it is, why?
 
+1 for beer coaster calculations. SSD could reach ~500Gb/s though. Memory mapping could be more efficient depending on the usage scenarios — sehe 14 secs ago
 
Ell
1:23 PM
@BartekBanachewicz I just recognise it is all :)
 
@thecoshman There's no point in defining "need" in a way that hurts you.
2
 
@BartekBanachewicz A 13 y/o quote?
 
You knew you needed to consider Y.
 
@Fanael I don't think that it's that; it's more about Dx really introducing another layer. (COM? I don't know, I am not an expert on Dx)
 
user784668
@sehe surprisingly, no
 
1:24 PM
@sehe a few months' old
 
@R.MartinhoFernandes But we needs the precious. :c
 
@R.MartinhoFernandes you did not need to, it just make sense to take the blinkers off
 
@thecoshman If you did not need to, then you wasted time.
Simple.
Drop the crystal ball and keep the blinkers.
 
@BartekBanachewicz My best guess is that DirectX -- as a layer -- ships some of its calls through the OS, while OpenGL is free to parlay directly to the vendor/driver in its implementation (since Windows isn't providing the library, your graphics card vendor is).
It's probably 1 slim layer of indirection that's adding the microseconds of difference.
 
@R.MartinhoFernandes I'd argue the extra work involved in doing feature Y because you ignored it until you HAD to work on it outweighs the extra work of making it easier to do feature Y whilst working on feature X. And again, it depends very much on the situation.
 
1:26 PM
@thecoshman You're not doing feature Y. You're just designing with it in mind.
Doing feature Y is for later.
Yes, it depends on the situation. It depends like this: do you need it?
 
ITT @thecoshman still doesn't understand YAGNI
 
Put it this way, if I asked you heat some water. How hot will you heat it at a moments notice? What if I said I might ask you drink it down in one go? It's going to change just how much you heat that water.
 
Sorry, I don't understand the second question :S
 
nobody did
and this analogy is totally badly picked.
 
Anyway, I won't bother discussing "here, have completely underspecified requirements".
The way to work on those is to ask for a better specification, not to start guessing.
 
1:30 PM
yeah, using a crystal ball to guess what might the reqs be is retarded
 
5 mins ago, by R. Martinho Fernandes
Drop the crystal ball and keep the blinkers.
 
set them firmly and ask for cash for every change
 
You could just put it on the hob and have it to boil, trivial to do, don't even have to watch it. But knowing I might ask you drink it down in one go, you probably want to just put it on a low heat.
 
@thecoshman I would ask for more precise reqs before starting to heat the water.
 
@thecoshman So what? Where's what I need: to heat it to a drinkable temperature. Here's what I'll do: heat it to a drinkable temperature.
 
1:31 PM
@thecoshman like, "how much and how how hot you need it"
@thecoshman that's like saying "I will need you to fix something in my house", and you are bringing a crane and a bulldozer just in case I'd like you to move some walls.
 
@Telkitty猫咪咪 Yep that was my last phone ;P
 
@BartekBanachewicz do you have a good reason, such as someone said "btw, I probably need it bulldozed" to believe you need a buldozer
 
@thecoshman I would ask "are we going to move some walls"? Because "we will probably need a bulldozer" is a ridiculous request without more information.
 
user142019
According to GitHub, my three top languages are shell script, Java and Perl. :|
 
When you leave the house, you don't just think "it's sunny this very second, I'll leave the coat", you think "hmm... it's probably going to rain today, I'll bring a coat anyway" assuming you have reason to believe it will probably rain.
 
1:36 PM
@rightfold Obj-C here
@thecoshman irrelevant. And until you start using real arguments, I am also out of this discussion.
 
haha "real arguments" coming from @Bartek
 
@thecoshman I don't.
 
@BartekBanachewicz it's the same principle. The requirements AS you leave the house are "you do not need a coat", yes you have a good reason to know you probably will need a coat.
 
@BartekBanachewicz if I keep staring at a description of pipeline steps, will it eventually make sense?
 
@Pawnguy7 no
 
1:38 PM
@Pawnguy7 probably not :(
 
And admit it, that's a really horrible analogy.
 
@R.MartinhoFernandes don't what? Ever think that the weather might change after you have left the house?
 
@thecoshman Yes.
 
@R.MartinhoFernandes I never denied that :P
 
Ell
Well he doesn't live in the Uk to be fair
 
1:39 PM
@thecoshman except you can't force the clouds to decide on the weather once and for all, whilst with requirements you can
 
Ell
The UK's weather requires many agile and scrum techniques
 
@BartekBanachewicz You cannot force the clients either.
 
@R.MartinhoFernandes but you can make them pay for every change
 
@Borgleader gah. He even posted that crap as an answer. I honestly don't see how that got 1 upvote, while mine is still at 0 (note the other +1 was by me)
 
Not your job, though.
 
1:39 PM
@thecoshman I always take a jacket with me to the pub, and people always tell me "why are you wearing that? It's so hot!" Without fail, those people are bitching about the cold once the sun has gone down. Every time.
 
@BartekBanachewicz no. You can get clarification on those requirements, but you can not force them to not want to change.
 
@sehe oh wow he did...
 
46 secs ago, by Bartek Banachewicz
@R.MartinhoFernandes but you can make them pay for every change
 
@thecoshman Reality check. Most of the time you'll have to convince people to want to change
 
@BartekBanachewicz Internal requirements are 'free' to change (time though of course)
 
1:40 PM
I am being trolled quite hard
 
user784668
@sehe have an upboat
 
@thecoshman Doesn't matter. You cannot assume different ones.
 
@thecoshman so it shouldn't even concern you
 
@sehe I never mentioned 'customers', bartek did
 
That's just stupid. (And that's what YAGNI is about)
 
1:41 PM
13 mins ago, by Bartek Banachewicz
ITT @thecoshman still doesn't understand YAGNI
 
@Magtheridon96 Not unusual in this room.
 
@R.MartinhoFernandes I am not assuming different requirements, I am acknowledging that requirements probably will change, and it will easier to accommodate for that change now.
 
@thecoshman That's the same as guessing, and you should not waste your time on it.
 
also, the related questions list, is that the one that shows up when youre writing a new question?
 
@thecoshman If you want to acknowledge that requirements probably will change, I'll take your original example and twist it.
 
1:42 PM
@Borgleader aye
 
ah thought so
 
"Hey, implement X. We may need Y; I'll tell you in a week". You go and implement X in a way that makes Y impossible because fuck it, requirements will probably change.
 
@TonyTheLion On SO. I get 1 upvote, 1 minute later, it goes away and turns to a downvote. I've been oscillating between 4406 and 4396 for about an hour :D
 
Note how I don't mention what happens a week later.
 
@R.MartinhoFernandes :)
 
Ell
1:43 PM
I can't think of the best way for finding and replacing a set of consecutive elements in an array is (imagine finding sets of 3 in a bejewelled type game)
 
You cannot delay your decision until a week later, so you should think of it without the knowledge you get a week later.
 
@R.MartinhoFernandes I beg to differ. If it will take me an extra day to accommodate for it, and I have time to do so. If I ignore the future requirement, it will take me weeks to implement it
 
@thecoshman ?!?!?!?! Why are you telling me. Not only customers are people, you know
 
user784668
Oh my.
 
@R.MartinhoFernandes s/may/will almost certainly/
 
user784668
1:44 PM
0
Q: Memory allocation for vectors

SakshamAs far as I know that for both vector declarations as: //TYPE 1 vector<cls> vec; //cls is user defined datatype(A class) Memory for vector is allocated on stack and the memory of contents in the vector is allocated on heap. It is true for the below declaration as well(Correct me if I am w...

 
@thecoshman Yes, and when future requirement Z comes along your affair Y has just made it impossible without rewriting the whole shebang.
And guess what? You cannot even remove Y, because it's now an officially supported feature.
Well done, chump.
 
@R.MartinhoFernandes I never said you can plan for every possible feature.
 
@thecoshman Wait why? Where do you draw the line and stop guessing? Your (lack of) imagination?
 
Nor did I say you fully implement feature Y, I am saying how you do feature X will change based on feature Y
 
@thecoshman Fuck off.
 
1:45 PM
@Borgleader That's a pretty poor duplicate. Next time include [c++-faq] in your search criteria? — sehe 28 secs ago
 
I feel like talking to a wall now.
 
@sehe I can see my inbox thx :P
 
@R.MartinhoFernandes Because there is a difference between requirements that are actually being defined and those that are just made up.
 
Guessing is bad. I know, I've done it and it hit me in the face with a bat.
 
@Borgleader You know, it's precisely this attitude that made me post here as well. "kthxbai"
@R.MartinhoFernandes Deliciously ambiguous
 
1:47 PM
@thecoshman Yes, and the difference is that the former you need to consider.
 
@sehe huh?
 
@Borgleader Are you in a hurry?
My response didn't just concern you. It concerned the 'community mods'. I like to believe they flock around here, in part
 
@R.MartinhoFernandes eventually they will be needed, but not right now, and there is a change, though small, that the feature may be pulled.
 
hello can anyone explain what will be answer of this=
 
user142019
@BartekBanachewicz I fixed it by deleting the repository of my last school project. :D Now I have Shell, Erlang, VimL, even though there isn't a single line of Erlang code in any of my GitHub repositories.
 
1:48 PM
int a = a;
 
That's where the crystal ball comes in, I suppose.
 
Xeo
@Vishal nothing worthwhile
 
@thecoshman Maybe, don't just drop the crystal ball, but also the fruitless conversation
 
@rightfold just fuck those statistics
 
@thecoshman Godammit, would you read?
 
1:48 PM
@sehe I've seen so many of thse, and it kinda irked me that he didnt bother to look at the related questions so yeah...
 
@Vishal 42
 
@R.MartinhoFernandes it's not a 'crystal ball' it's playing the odds.
 
@Borgleader Neither did you, apparently
 
how?
 
1:48 PM
@R.MartinhoFernandes you changed what you said after I responded!
 
user784668
@Vishal hello world
 
279
Q: Undefined Behavior and Sequence Points

Prasoon SauravWhat are "Sequence Points"? What is the relation between Undefined Behaviour and Sequence Points? I often use funny and convoluted expressions like a[++i] = i;, to make myself feel better. Why should I stop using them? If you've read this, be sure to visit the follow-up question Undefined Beha...

 
would you stop this silly argument already????
FAMNIT
 
ITT Software development is gambling for @thecoshman
 
@Vishal compile error?
 
1:49 PM
no
 
user784668
@Azzu not relevant, no sequencing involved
 
@thecoshman I had said it twice before already so I didn't feel like being excruciatingly clear.
 
it compiled perfectly
 
@Vishal why is that?
 
answer is 846
 
1:49 PM
@Azzu there are no sequence points in C++11
 
i dont know how?
 
@Vishal No it isn't. Compile in release mode. The answer is UB. Now, go read the linked article(s)
 
@BartekBanachewicz oh, because clients never pull out or go under ¬_¬
 
@Vishal probably UB
 
1:50 PM
@thecoshman You would make an awesome client
 
@Vishal it's UB
 
UB???
 
undefined behavior
 
also shitty questions
 
@Vishal it can jump up & catch fire
 
1:51 PM
let x = x is fine in Haskell. Take that.
 
user784668
Halt and Catch Fire, known by the mnemonic HCF, refers to several computer machine code instructions that cause the CPU to cease meaningful operation. The expression "catch fire" is intended as a joke; the CPU does not catch fire. It is also occasionally referred to as "SDI" for "Self Destruct Immediate". In early CPUs The HCF instruction was originally a fictitious instruction, said to be under development at IBM for use in their System/360 computers, along with many other amusing instructions like "Electrocute Computer Operator". One apocryphal story about the HCF instruction goes bac...
 
heheh
 
@sehe Hmm, after reading chris' answer fully I admit I dropped the ball on this one. I stopped at "The problem that the linker is complaining about is that you've declared your member functions in Poker, but haven't defined them." which was fine for me. I should have read on.
 
user784668
@R.MartinhoFernandes but it's bottom
 
@Fanael whistles
 
1:51 PM
what is UB??
 
It means the behaviour is undefined.
 
undefined behavior
2nd time
 
A wonderful thing.
Here, let me show you something great...
 
lol
Noooooooooooooooooooo
 
@ThePhD cowboy cast?
DO IT
 
1:52 PM
inb4 bin
 
hmm thanks but what is 846?? is it random garbage value?
 
i got that pic saved
i love it so much
@Vishal yes
 
@Vishal yes garbage
 
thanks
:)
 
user142019
1:53 PM
Uninitialized variables should be 666 in debug mode.
 
thanks tony and R.Martinho
 
user142019
In Objective-C stuff is zero-initialized. At least, pointers to Objective-C objects. Not sure about integers.
 
@rightfold The number of the beast.
 
user142019
@TonyTheLion Midsomer Lions
 
user784668
@rightfold it's C, so UB
 
1:55 PM
@R.MartinhoFernandes You agree that if you know a feature is going to be wanted, but no deadline has yet been set, you should still develop towards it, yes? There may be features that need to come first, but if you ignore the later features, they will be harder to do. So it makes sense to design the earlier features to account for that later features, even if it is a bit more work. The only difference that I am saying is that these later features are not 100% set in stone.
 
user142019
@Fanael It's a superset of C.
 
@rightfold hahah
 
user142019
And UB can be made non-UB in a superset of C.
 
@Fanael Objective-C is quite different from C
 
@thecoshman STAHP. The discussion is over. Haven't you realized that?
 
user142019
1:55 PM
Because zero-initialization is perfect behavior for UB.
 
34 mins ago, by R. Martinho Fernandes
@thecoshman Doesn't matter, you still needed to design for it.
 
@TonyTheLion (╯°□°)╯︵ ┻━┻
 
user784668
@R.MartinhoFernandes for fuck's sake, you two still discussing YAGNI?
 
that's unfortunate outcome of an argument :(
 
1:57 PM
@Fanael pirate still can't understand it
 
@TonyTheLion manslaughter?
 
maybe
 
@thecoshman - YAGNI is a principle behind the XP practice of "do the simplest thing that could possibly work" (DTSTTCPW)
 
user142019
@thecoshman Chuck Norris turns laughter into manslaughter.
 
oh gawd
 
1:58 PM
> It is meant to be used in combination with several other practices, such as continuous refactoring, continuous automated unit testing and continuous integration. Used without continuous refactoring, it could lead to messy code and massive rework
 
Ell
oooh another storm is comiing :D
 
I figured maybe he doesn't even know what YAGNI is in the first place and we keep using it.
 
@BartekBanachewicz yes? does not mean I will work with blinkers on. I would still break leading into corners, I will still bring a coat with me if it might rain, I will still consider upcoming features.
 

« first day (1017 days earlier)      last day (3932 days later) »