« first day (649 days earlier)      last day (4313 days later) » 

11:00 PM
oh yes... I included it in the class not the main.... thanks
 
@Chimera God, my @Jim<tab> muscle memory is killing me. Anyhow, thought you'd be interested in stackoverflow.com/questions/11677557/…
 
In {1,2,3}, does next last mean 2 ?
 
@Drise Yes thank you... I'm very much interested in that. Good question.
 
You can edit messages on mobile.
 
How?
 
11:02 PM
@KeithLayne It's not easy.
@sehe There's a menu at the bottom.
 
Oh good. I use the 'full' version usually
 
Ugh. Close votes...
-1
Q: What should I know before moving to GUI-based applications?

user1515422I've been thinking about moving on to making applications with GUIs for some time now, but not sure if I'm ready to move on. Is there some type of list that will tell me what I should know before moving on? The last think I want to do is to get there and end up not knowing what I'm doing. Examp...

 
@Chimera did you include stdexcept?
 
I don't understand what tapping messages is supposed to do. I was hoping it would respond to it.
 
@MooingDuck I have it included now. I'm currently trying to print out what(). I assume what() returns std::string?
 
11:06 PM
@Chimera what() always returns a const char*, since some exceptions cannot hold strings. (most do hold them, but some can't)
 
@KeithLayne Me too
 
@MooingDuck ok
@MooingDuck YES!! It works! Thanks again everybody.
Now to deal with destructor on failure of constructor.
 
That guy in the question is going in the wrong direction.
 
@Chimera just rename your constructor destroy, make it protected, and make a new destructor that calls destroy
@Chimera are you 100% positive that all members are fully initialized and valid before the error is thrown?
 
@Drise Thats my post. :D
 
11:10 PM
Haha. Well, it's too subjective. And the first comment pointed it out clearly. Sorry.
 
@MooingDuck Yes, I'm throwing the exception only when the code fails to get a resource. All resources up to that point are good.
 
hmm, someone should make a question and try to get all 5 close vote reasons. The most I've seen is four.
 
You guys are the ones who told me to ask that. q.q
 
@Chimera Also, that should have been a comment.
@user1515422 Were we?
 
@Chimera including the member you're going to assign the new resource to?
 
11:12 PM
@Drise Yeah, earlier today some people chatting here told me to ask there instead of asking that here.
 
@Drise Why for?
 
@user1515422 Oh, well, yea. Asking questions here is likely to get you trolled away. But that isn't an SO question either.
 
@MooingDuck Yes, that member of the struct is initially set to NULL
 
@Chimera It's relevant to the question, but not as an answer. It doesn't actually answer anything.
 
@Drise Hmm, the list he is asking about is in the book. :-)
 
11:13 PM
@Drise Then where should I ask it? I just want to know what a beginner in C++ should know before considered "Intermediate".
 
@Chimera Where do you intend to call destroy() besides the destrictor?
 
@user1515422 you mentioned it here and there responses were "Chat is for chatting.", and... oh. InSilico did tell you to ask on SO. Well he shouldn't have done that :(
 
@user1515422 You should just program things. That's how I learn. When you run into problems, ask.
 
@Chimera good to go then
@user1515422 school, or a book, or an online tutorial.
@n2liquid constructor
@Drise ah, but what to learn? THere's lots that we dont' know that we don't know that we don't konw.
 
@Drise I guess I could move onto sockets.
 
11:15 PM
@user1515422 Fail a few times, succeed on others, learn all the way.
@user1515422 I wouldn't recommend it.
 
@Drise Why not? There doesn't seem to be much left I haven't covered.
 
@MooingDuck Well, if he listed STL as a thing to learn...
 
@Drise I'm on my second C++ book and it's starting to bore me.
 
@user1515422 You listed STL as something you need to learn, no?
 
@Drise for instance, a stream that handles , for the "decimal place"... that's complicated, and most people don't realize it
 
11:16 PM
@user1515422 Fuck books.
 
@MooingDuck Inside a catch()?
 
@n2liquid yes
@user1515422 your first book didn't talk about hte STL? Not a very good book.
 
hmm
 
3 hours ago, by Cat Plus Plus
All C++ books are bad until proven otherwise.
 
@user1515422 Then write some code.
 
11:17 PM
@Drise no, we definitely recommend good books here. People need books
 
@Drise Why not? Should I not learn about data structures?
 
@Drise he was referring to the ones not on our book list
 
@MooingDuck He better have pointers initialized to NULL before running destroy(), right?
 
@MooingDuck Until proven otherwise.
 
11:17 PM
That took a while.
 
@n2liquid that's what I cautioned him, yes
 
This is a good book.
http://www.amazon.com/Accelerated-C-Practical-Programming-Example/dp/020170353X/ref=sr_1_1?s=books&ie=UTF8&qid=1343344158&sr=1-1&keywords=accelerated+c%2B%2B
 
@Drise When did I say I needed to learn about STL containers?
 
@R.MartinhoFernandes That looks like somethign out of quantum mechanics.
 
@user1515422 in your question
 
11:18 PM
Example of the List:

Smart Pointers
...
Pointer Arithmetic
...
STL
 
@MooingDuck That was an example. >.>
 
I definitely see STL there.
 
naked pointers
 
@MooingDuck Oh, I didn't see part of the discussion, nvm
 
@Drise pointer arithmetic? I didn't even notice that
 
11:19 PM
new/delete
 
@n2liquid They are :-)
 
@Drise That was an example of the list I was looking for.
 
@MooingDuck Er, pointer ++?
 
9 mins ago, by Mooing Duck
@Chimera are you 100% positive that all members are fully initialized and valid before the error is thrown?
 
11:19 PM
@Mysticial I've already covered the heap and dyanmic memory allocation.
 
@Drise I didn't notice it was on his list
 
@R.MartinhoFernandes Quantum particles popping in and out and such
 
You guys are so inconsistent. ._.
 
@user1515422 You're talking to a different subset of people.
 
Meh, I'm not changing it. That took waaaaaay too long. I need to sleep now.
 
11:20 PM
@R.MartinhoFernandes Not asking you to, just reminded me of quantum mechanics.
 
@Drise Well it's very confusing at times. What exactly is wrong with books?
 
@user1515422 They are usually bad and teach bad practices. Like GOTO, or using namespace std;.
 
@user1515422 There's a lot of bad C++ books, be sure to get one on our approved list stackoverflow.com/questions/388242/…
 
@Drise Then where should I learn?
 
6 mins ago, by Mooing Duck
@user1515422 school, or a book, or an online tutorial.
 
11:21 PM
@user1515422 From whitelisted books (:
 
@user1515422 You, cppreference.com, SO.
 
@Drise Which is why I recommended the book I did. It's a good one. //cc @Drise
 
Is C++/CLI still considered a "good way" to interop native/managed code?
 
@Drise I don't use any of those.
@Drise I use the std:: prefix.
 
@IDWMaster Is there any other way?
 
11:22 PM
@user1515422 Are you confusing cppreference.com with cplusplus.com?
 
@user1515422 +1 internets. Seriously, using namespace std; needs to be abolished.
@n2liquid Definitely not.
 
@MooingDuck I'm 13 so I wouldn't be able to attend any school for programming.
 
@R.MartinhoFernandes There's COM, Inter-process communication, and P/Invoke.
 
-1
A: Learn about <vector> by re-writing an old C++ class's array exercise

DriseSimply follow this link. cppreference.com is your best friend.

 
@IDWMaster Ah. Ok.
 
11:23 PM
@user1515422 Didn't you say you were 12 a few hours ago?
 
@user1515422 then a book or online tutorial
 
@Mysticial I'm not allowed to be 12 here. -_-
3
@MooingDuck Do you know any quality online tutorials?
 
@Mysticial No, he said he was 13.
 
@user1515422 unfortunately no, I taught myself out of a book :(
 
Well, the book I did read was on game programming and I'm not interested in that.
 
11:24 PM
Hey, my rate curve interpolator's performance increased by nearly 20% overall. Thanks SSE.
This is a good day.
 
@user1515422 On the internet, age is simply a number, not a guideline for behavior.
2
 
@R.MartinhoFernandes I'm assuming you've always used C++/CLI.
 
@Drise I never said it was, he told me to go to school and learn C++.
 
@user1515422 Meh.
 
Is The C++ Programming Language not as good with beginners as The C Programming Language?
 
11:25 PM
@user1515422 It's a quote I love to say when people mention their age on the internet.
 
What do you guys think about wikibooks.org?
 
@IDWMaster The few times I needed it, yeah. I didn't use it much though.
 
@Drise Damn, I like that!
 
@user1515422 But seriously, write a few program, fail a few times, ask questions on SO, succeed the next.
 
@Drise What programs should I write?
 
11:27 PM
@n2liquid But seriously, I could be 30 if I pleased, so long as I act accordingly.
 
@Drise There doesn't seem to be much left to do other than small challenges.
 
@user1515422 I enjoyed rewriting vector, that was educational
 
@user1515422 Come up with some. Write a binary search tree, like I did.
 
@user1515422 Maybe write a memory manager.
 
@MooingDuck It was fun rewriting std::string, even if I didn't finish it. I guess I could try that.
 
11:27 PM
@user1515422 including the allocator? string is harder than vector
 
@user1515422 Meh, strings.
 
@MooingDuck Only because it has all that crap in the interface.
 
Perhaps you should try writing a decent UI framework.
 
You guys are a lot more helpful than hackforums. All I would hear when I asked these questions was "Tic-Tac-Toe" and "search an array".
 
@R.MartinhoFernandes yes
 
11:28 PM
>.>
@MooingDuck Nooo, just the basic member functions.
@MooingDuck That would be a challenge.
 
Idk, in my original language, VB.net, strings were a simplistic type. Why C++ doesn't have them built in amazes me.
 
I originally started with C#.
 
@Drise ... speed. choice
 
@Drise it doesn't need them, also backwards compatability
 
@Drise What do you think "this" is?
 
11:30 PM
@user1515422 erase(begin, end) is the big challenger
 
In C++ you only pay for what you need. You can always redecorate the house. Do without the stdlibs
 
@MooingDuck Challenge accepted. :D
I have one more question for you guys before I get some sleep.
 
@MooingDuck Mostly because the specs are surprising, or because of the exception safety guarantees?
 
@user1515422 Next problem: You sleep.
 
He Sleep(time)s.
 
11:31 PM
@sehe I think I mostly found shifting the elements in a performant manner tricky. I think exceptions came into it, I don't recall.
@sehe oh wait, now that I think on it, I wasn't doing vector at the time, it was a deque.
 
@IDWMaster I just Yield(). Done with it much quicker
 
std::this_thread::sleep_for (std::chrono::hours (9));
That about right?
 
std::this_thread::sleep_for(4_h); // :P
 
Jesus christ, I'm dealing with PHP code that my 40-year old boss wrote when he was learning PHP
and it's still in use
 
@n2liquid :eyevomit:
 
11:33 PM
@MooingDuck That's interesting since you might be moving from one 'chunk' to another. Oh damn. That's crazy on a deque. Why did you do a deque?
 
@R.MartinhoFernandes, I never thought of user defined literals. Ooh...
 
@sehe because it was hard
2
 
@MooingDuck It is supposed to be. deque isn't a trivial container. I wonder what the complexity/invalidation guarantees on deque::erase read
 
What's more efficient? Searching for the null-terminated character in a string, or calling the member function size?
Example: for(int i = 0; str[i] != '\0'; ++i) or for(int i = 0; i != str.size(); ++i)
 
11:34 PM
@sehe technically I wasn't doing a deque, but something similar.
 
@user1515422 They do different things.
 
@user1515422 Size. I'm pretty sure it tracks it as you create the string.
 
Use iterators.
 
@sehe What if you just want some Sleep(time) though?
 
^ that
 
11:34 PM
@sehe erase is O(n), Invalidates everything
 
@R.MartinhoFernandes, Certainly interesting.
 
@IDWMaster waste of time
 
@Drise Really? q.q
 
In C++03 a std::string isn't guaranteed to have a null terminator.
 
@user1515422 size usually
 
11:35 PM
size is constant complexity
 
@user1515422 I'm pretty sure. Just like vector.size
 
I just had to look that up
 
@chris So is str[i] = '\0'
 
@user1515422 yes
 
@MooingDuck Oh, that seems fair. You could do better, a lot. I take it n is the size of the container, not the range to be removed
 
11:36 PM
@MooingDuck q.q Well that sucks for me.
 
@sehe sure, you can beat that, but at the expense of the O(1) lookup
 
@MooingDuck yes
 
@MooingDuck No I just meant best case, which, admittedly is irrelevant for big-O. Just forget I said that :)
 
@sehe it's also O(1) erase from ends
 
@MooingDuck The whole point of deques
 
11:37 PM
@R.MartinhoFernandes, I was responding to whether it was better to loop through (which is obviously linear), or use that.
Oh never mind the code still loops with it, got it.
 
You need to actually profile. The check of index vs. size() might well be faster, IFF the compiler inlines the body and hoists the size() value. It might.
 
@chris what?
 
It's nothing. Everything I say is pointless.
 
Does std::string keep track of size or compute it as a difference of 2 pointers?
 
@MooingDuck someone thought that message made a funny out-of-context star. /cc @Cicada It wasn't me :)
 
11:39 PM
@Prætorian implementation defined (though size_t makes more sense to me)
 
@chris You should try Haskell
 
@Prætorian You'll have to use the Source, Luke.
 
Damn. I'm nearly at 1300 rep. Getting close to the magical 2k.
 
@sehe I didn't think about it out of context. The star stands.
 
@Prætorian, size(), at least for random access iterators, is distance(begin(), end())
 
11:41 PM
If it is subtraction, str[i] != '\0' should be more efficient, assuming that the string is required to NULL terminated
 
is "Flex" a standard C++ technology that people have heard of, or is it something my company made up?
 
@KeithLayne Hehe. It looks out-of-context now, though :)
 
And distance is just last - first
For those at least
 
@sehe it's a win-win.
 
@MooingDuck flex/bison: lexer/parser generator
@KeithLayne it's a can-can.
 
11:42 PM
@Prætorian Now I'm confused; some say it's more efficient, others says .size is more efficient.
 
@sehe for us it seems to be a serializer, so I guess it's custom
 
If you want the standard quotations, both of those happened to fit in my answer: stackoverflow.com/questions/11660774/…
 
3 mins ago, by sehe
You need to actually profile. The check of index vs. size() might well be faster, IFF the compiler inlines the body and hoists the size() value. It might.
@MooingDuck I guess so too.
 
@sehe How would we know if the compiler does that?
 
@user1515422 it can also be different with different compilers/computers. In any case, they'll be close enough in speed that you don't care. Just pick one
 
11:43 PM
@sehe, Haskell is a few down on my to-learn list.
 
@user1515422 PROFILE IT. Also, look at the generated code. If it is important: make it explcit.
 
@user1515422 What @sehe said, and the fact that prior to C++11 std::string was not required to be be null terminated (although I doubt you'll find an implementation where it's not)
 
Wait, that changed?
 
@sehe How do I profile it? I've never done any benchmarking on my programs.
 
size_t size = v.size(); for (size_t i=0; i<size; ++1) { /* dostuff */v[i]; }
 
11:44 PM
@chris yes
@user1515422 don't bother, they're basically the same speed
 
@user1515422 Lots of questions about that on Stack Overflow
 
@user1515422 Write a timer class... I have one around here somewhere.
 
@Drise you guys are just confusing the poor user :(
 
@MooingDuck Depends. Without optimization, using .size() in the for condition is definitely slower, not comparable
 
@MooingDuck Yes, they are.
 
11:45 PM
@chris Yeah, I think something about the complexity requirements changed which disallows null terminating only when you call c_str()
 
I have a timer class but it sucks
redoing it a bit when GCC gets <thread>
 
@Prætorian No, there's really an explicit requirement that str[str.size()] be charT().
 
@Prætorian No. It changed in such a way that .data() now by definition also contains the null terminator
 
@sehe even if it is slower, he probably wont notice
@R.MartinhoFernandes that could have been special cased
 
@MooingDuck So ?
 
11:46 PM
Even better, I read that complexity stuff in some SO comment
 
@Prætorian Yeah there was a funny question around this when c++11 was just ratified
 
@MooingDuck So? That's all that's needed for the code in question.
 
I do a lot of challenges and we all see who has the faster program. That's why I really need to know which one is faster.
 
54
A: Is string::c_str() no longer null terminated in C++11?

Mikhail GlushenkovStrings are now required to use null-terminated buffers internally. Look at the definition of operator[] (21.4.5): Requires: pos <= size(). Returns: *(begin() + pos) if pos < size(), otherwise a reference to an object of type T with value charT(); the referenced value shall n...

@user1515422 No you don't. Micro optimization is useless, makes the program error prone and hampers other optimizations
 
@user1515422 Meh, compiler can optimize most of your code away, making it arbitrary.
 
11:48 PM
@user1515422 The only way to know which one is faster is to run your program with them both.
 
@sehe Ha! That guy thought they went the other direction :)
 
This one loop and it's puny overhead is NOT going to dominate your runtime
 
So I shouldn't even bother with little things like that?
 
@Prætorian Well, the text became a hell of a lot more implicit. It's all implicit by way of complexity requirements, in a way.
@user1515422 Unless your profiler tells you to
 
o.o
 
11:50 PM
wtf was that
 
@Drise wow. That was uncalled for
 
Yeah
 
@sehe It slipped out. Sorry.
 
Huh
What's wrong with that ?
 
WTF was that?
 
11:50 PM
What does that even mean?
 
std::vector<__m128> blah;
blah.push_back(__m128());
 
I'm laughing
 
Real interesting debate :)
 
Not sure I get it
 
:4692369 Thanks for immortalizing that.
 
11:51 PM
@user1515422 right
 
@Prætorian There's another forum for it
@Drise That would be unethical. Just lent @n2liquid a chance to reread
 
Oh snap, I missed that being too busy pastaing code.
 
@sehe I appreciate
 
@kbok looks fine to me
 
@sehe Sorry. I'm not in the best mental state. My fiance just left for Germany. For a year.
 
11:52 PM
You're free for a year!
 
@kbok Didn't they teach you that in algorithms class? Vagina operators have no impact on resource complexity.
Jun 13 at 23:34, by sehe
May 2 at 2:06, by Pubby
Use the vagina initialization syntax ({})
2
 
rofl
 
lol
 
damn, must focus
 
@sehe I'm glad no one posted that on that silly boobs operator question.
 
11:54 PM
lol what.
 
You're just trying to get me to do it for you :)
No chance
 
@kbok it's deleted, makes it trickier to find.
 
@sehe No, I'm not!
 
@sehe Nice.
@MooingDuck I'm pissed at that. You got a lot fo good rep from it, and it was a half interesting question.
 
@Drise meh, opportunities come and go
 
11:56 PM
Half interesting? Really?
 
One boob is enough for him
 
"How can I get <random blob of text> in meaningful C++?"
Sounds exactly like some of Johannes silly puzzles.
 
:)
 
Except that, at least with Johannes you would learn some weird corner case of C++ in the end.
 
@R.MartinhoFernandes Idk. I don't like males (or assumed to be males) showing that all we are is obsessed with boobs and vaginas. I'm tired of that stereotype.
 

« first day (649 days earlier)      last day (4313 days later) »