- Tutorial on threaded binary tree part 2: BST with subtree height differences - 4 Updates
- implementation of configuration file in c++ - 1 Update
- reference of type 'unsigned char*&' from an rvalue of type 'unsigned char*' - 3 Updates
- Go to church today - 1 Update
- X operator=(const &X) - 3 Updates
- String and string_view - 1 Update
- references to pointers - 1 Update
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Dec 11 05:44PM On 11/12/2016 07:13, Alf P. Steinbach wrote: > | | | 9.000000 [height diff -2] > | | | | () > [/output] Why are you using a std::stack rather than the much quicker machine stack (i.e. why aren't you using recursion to update heights)? /Flibble |
Gareth Owen <gwowen@gmail.com>: Dec 11 06:10PM > Why are you using a std::stack rather than the much quicker machine > stack (i.e. why aren't you using recursion to update heights)? Definitely worth quoting 250 lines of code for that. |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Dec 11 06:23PM On 11/12/2016 18:10, Gareth Owen wrote: >> Why are you using a std::stack rather than the much quicker machine >> stack (i.e. why aren't you using recursion to update heights)? > Definitely worth quoting 250 lines of code for that. Bandwidth isn't an issue these days and if your Usenet reader is any good it will allow you to expand/collapse quoted text so in a word: meh. /Flibble |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Dec 11 10:05PM +0100 On 11.12.2016 18:44, Mr Flibble wrote: >> [snip] > Why are you using a std::stack rather than the much quicker machine > stack (i.e. why aren't you using recursion to update heights)? Three main reasons why I chose iterative: * The version 1 add() was iterative. I've just added a few statements to the original code there, to remember the parent node chain. * I felt stupid/slow, at the end of the day for me in the morning. Didn't feel up to rewriting the above as recursive. One would have to do the updating on the unwind part, and since there's no picture of that popping up in my mind even now, I guess iterative is simpler, yes? * This way allowed a nice separation of add() and update_height_differences(), I'm not sure how to do that separation, or some other suitable abstraction, in a recursive version? Also, will the machine stack (pushed arguments) necessarily be faster than a std::stack allocated with suitable small sufficient capacity (height of tree, = log2 N)? After all there is the call overhead. And another possibility is to use a linked list of nodes allocated from an small array with just free-list, which should be super-fast? Well, maybe I as tutorial producer shouldn't be asking questions, but hey, I'm here to learn too. :) Cheers!, - Alf |
"Öö Tiib" <ootiib@hot.ee>: Dec 11 10:18AM -0800 On Sunday, 11 December 2016 07:16:24 UTC+2, kushal bhattacharya wrote: > to put it in a correct way this config file will have xml and json XML and JSON are (software- and hardware-independent) data formats. Both are widely used for storing and exchanging whatever data. What is the point of combining XML and JSON that do same thing? |
Jerry Stuckle <jstucklex@attglobal.net>: Dec 11 10:35AM -0500 On 12/10/2016 8:15 PM, ruben safir wrote: > especially if it s a lot of data in big memory heaps. > Then I might want to assign big data to a reference to an internal > pointer to a new heap object. Maybe people keep discussing it because they are right and you are wrong. You obviously do not understand encapsulation. Maybe you should be going back to SmallTalk in the 80's. Those people understood (and still do) proper OOD. It is more than just "making a coherent API". It is also preventing bugs by ensuring the object is always valid - or doesn't allow operations on invalid objects. You can assign to any private member in an object. But to do it correctly you need to validate the value being assigned. And that can't be done by returning a reference to a private member. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ================== |
Jerry Stuckle <jstucklex@attglobal.net>: Dec 11 10:38AM -0500 On 12/10/2016 8:21 PM, ruben safir wrote: > The first purpose of OO coding is to create easy to debug, maintainable > and documentable code. It is about the human coders. the computer > software could care less. It is about project management and development. Oh, yes, some designs do smell. And some just plain stink. And perhaps programmers at Sun know more about OO than you do. Yes, OO is in part about creating easy to debug, maintainable and documentable code. But that can be done in any language. OO is mainly about producing code with fewer bugs. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ================== |
Jerry Stuckle <jstucklex@attglobal.net>: Dec 11 10:39AM -0500 On 12/10/2016 8:22 PM, ruben safir wrote: > On 12/10/2016 05:39 PM, Jerry Stuckle wrote: >> No, Paavo is correct. > he is not even on the topic. He is correct. As was Sun, as was Stroustrup, and as are those Java programmers who have tried to tell you the same. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ================== |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Dec 11 07:24AM -0800 Ask questions about Jesus. Seek answers. Demand to know the truth, but be ready to receive it. This world teaches us certain things. Nearly all of them are literal opposites of Biblical teachings, and specifically the teachings of Jesus Christ. It makes it more difficult to receive the truth about Jesus Chrisr because it bucks in the face of your "knowns." By seeking the truth though, when you hear it you will know, because God will make sure you know ... when you seek the truth. You are not alone on your journey to faith. Many prayers are with you, and Jesus has your back. If you seek the truth, you will find it. Best regards, Rick C. Hodgin |
ruben safir <ruben@mrbrklyn.com>: Dec 11 05:31AM -0500 On 12/10/2016 12:13 PM, Öö Tiib wrote: > implicit conversion constructor from int to X thanks |
Bo Persson <bop@gmb.dk>: Dec 11 11:51AM +0100 On 2016-12-10 22:41, Richard Damon wrote: > Second, you may never derive a class from X now (or at least any class > derived from X can't chain to this operator=, unlike the normal, and > default, assignment operators). And also, in case the new throws an exception we will end up with a destructed object that isn't reconstructed. Bad things will follow. Bo Persson |
Paavo Helde <myfirstname@osa.pri.ee>: Dec 11 03:02PM +0200 On 11.12.2016 12:13, Ralf Goertz wrote: > meant to be a regular contructor. In the context of my original question > it is clear why I need this constructor. How else am I supposed to > initialise a constant reference cr in my class? What they are trying to say is that such constructors should be declared with the 'explicit' keyword. |
Bo Persson <bop@gmb.dk>: Dec 11 11:58AM +0100 > support for that has been added, but is only available in newer > compilers? G-d willing a new version of TrueOS -- trueos.org -- > \will land soon... There is support for that, but only in C++17. Not yet available everywhere. Bo Persson |
ruben safir <ruben@mrbrklyn.com>: Dec 11 05:32AM -0500 On 12/11/2016 05:26 AM, ruben safir wrote: > thunderbird doesn't have a dev null. actually it does.... good. |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment