- Restricting a class to dynamic instantiation via destructor access -- what about smart pointers? - 1 Update
- You could condense it down into fewer, larger, .CPP files. - 15 Updates
- Qucksort for Linked List - 1 Update
- A programmig error reported at the cppcon - 2 Updates
- Restricting a class to dynamic instantiation via destructor access -- what about smart pointers? - 1 Update
- Hashtable Copy Constructor Not working - 4 Updates
- HashTable Copy Constructor Issues - 1 Update
ram@zedat.fu-berlin.de (Stefan Ram): Dec 28 10:18AM >For a restriction to dynamic allocation by making the destructor >non-`public`, I wonder what would be a good way to support destructor >invocation via `std::shared_ptr` and other smart pointers? You probably already know this, but JFTR: Chapter 27 of "More Effective C++" is called: »Requiring or prohibiting heap-based objects.«. |
Jeff-Relf.Me <@.>: Dec 27 04:16PM -0800 |
Jeff-Relf.Me <@.>: Dec 27 04:32PM -0800 |
Ian Collins <ian-news@hotmail.com>: Dec 28 02:11PM +1300 On 12/28/16 01:16 PM, Jeff-Relf.Me wrote: > What does it do ? > You could condense it down into fewer, larger, .CPP files; > or not... it's up to you and yours, of course. Fewer, larger .cpp files has always been a pain for readers, on modern multi-core systems it's the best way to ruin build times. -- Ian |
Jeff-Relf.Me <@.>: Dec 27 05:22PM -0800 |
Ian Collins <ian-news@hotmail.com>: Dec 28 03:34PM +1300 On 12/28/16 02:22 PM, Jeff-Relf.Me wrote: >> on modern multi-core systems it's the best way to ruin build times. > For me, compile time is barely noticeable. > What are you compiling, and how long does it take ? ! A large control application along with about 50 other developers. A single target build takes several minutes on a 32 core machine. Not only would fewer, larger files be a nightmare to edit and build, we would have way too many merges to ever get anything done. -- Ian |
Jeff-Relf.Me <@.>: Dec 27 06:53PM -0800 |
Ian Collins <ian-news@hotmail.com>: Dec 28 04:14PM +1300 Please stop changing the subject.... On 12/28/16 03:53 PM, Jeff-Relf.Me wrote: >> A large control application along with about 50 other developers. >> A single target build takes several minutes on a 32 core machine. > What's being controlled, a robot ? Heavy machinery. > What OS are you running on this "32 core machine", > and how many people access it ? Some Linux, some Windows. All virtual machines on SmartOS hypervisors. >> and build, we would have way too many _merges to ever get anything done. > I can't imagine what it's like to work with "50 other developers", > all working on the same bit of code... That how most of us work... > are you Linus Torvalds ? Don't be silly, he works with scores of developers... -- Ian |
Jeff-Relf.Me <@.>: Dec 27 08:09PM -0800 |
Ian Collins <ian-news@hotmail.com>: Dec 28 05:35PM +1300 On 12/28/16 05:09 PM, Jeff-Relf.Me wrote: > because, to run, you have to wait on 50+ people, > running various _guest operating systems ( on the _host ), > controlling the (slow?) "heavy machinery". Nope, there's no waiting and the build machines are mainly cross-compiling for the machine controllers. > Checking code in and out limits the size of the .CPP file, > not compile time; whatever the limitations, still: > Fewer, Larger, .CPP files are better. Nope, build times are the bottleneck. If there were larger files, there would be less build distribution, some files would need too much memory to optimise, developers would waste too much time merging changes and they would get pissed off editing the large files. -- Ian |
woodbrian77@gmail.com: Dec 27 08:36PM -0800 On Tuesday, December 27, 2016 at 4:26:43 PM UTC-6, Ian Collins wrote: This poor man cried, and the L-RD heard him and saved him out of all his troubles. Psalms 34:6 |
Ian Collins <ian-news@hotmail.com>: Dec 28 05:42PM +1300 >> fuckwit > This poor man cried, and the L-RD heard him and saved him > out of all his troubles. Psalms 34:6 So you respond to a fair summary of your nasty, unjustified insult with more bollocks? Anyway, you haven't declared L or RD, so L-RD is a syntax error. -- Ian |
woodbrian77@gmail.com: Dec 27 09:24PM -0800 On Tuesday, December 27, 2016 at 10:42:57 PM UTC-6, Ian Collins wrote: > On 12/28/16 05:36 PM, woodbrian77@gmail.com wrote: You are trying to add your swearing back? Wow. I'm sorry, but things have changed now and changed for the better. Brian Ebenezer Enterprises - In G-d we trust. http://webEbenezer.net |
woodbrian77@gmail.com: Dec 27 10:16PM -0800 > You are trying to add your swearing back? Wow. > I'm sorry, but things have changed now and changed for the > better. It might be more accurate to say that things are changing and changing for the better... and I'm sorry that the places where things are changing for the better aren't more numerous. Syrians deserved better ... |
Jeff-Relf.Me <@.>: Dec 27 10:49PM -0800 |
"Öö Tiib" <ootiib@hot.ee>: Dec 28 02:08AM -0800 On Tuesday, 27 December 2016 22:16:38 UTC+2, Jeff-Relf.Me wrote: > _Loop() works fine; I don't use "concurrent_vector.h"; > even if I did, my local definition OverRides it. > I could change the name, of course. I don't create .H files. You may do or not do and use or avoid using whatever you want with your own code. That does not matter to others. However why you advice others to do these irrational things? These only waste time, give no benefits and make teamwork more difficult. > There are tons of macros/funcs/vars from outside libraries; > OverRiding them ( with local definitions ) does happen, rarely, > but it has little to do with underscores. Where is that readability? Your words lack logic. One who sees that _Loop in code most likely thinks that it is some compiler-specific keyword (like _Bool or _Complex of C). Later it occurs that it is just other guy misusing reserved naming convention for his own custom code-mutating macro. So it was confusing. "Confusing" is not synonym of "readable". If you write code that confuses others then it makes it hard to cooperate with you. That is bad since most software is not written alone. What I have typically seen are up to 10 teams of 4 to 8 persons per team. |
David Brown <david.brown@hesbynett.no>: Dec 28 10:03AM +0100 On 27/12/16 22:05, Mr Flibble wrote: >> You're funny. Not massively smart, but funny. > Not smart? Infinity is not a member of the set of ordinals (which must > be integers). As I said you are the fucktarded one not me. The ordinals ("counting numbers") don't stop at just the positive integers. The first infinite ordinal is known as "omega", or ω. The next infinite ordinal is ω + 1, then ω + 2, and so on up to ω + ω, or ω·2. You can keep going as far as you want - look up Wikipedia if you want to know how. However, 2·ω = 1 + ω = ω. There is no such thing as "the set of ordinals". There /is/ "the set of all finite ordinals", which is ω, since each ordinal is the set containing all previous ordinals. There is the /class/ of all ordinals, because there is a way to define ordinals, but it is not a set. For cardinals ("size numbers"), it is a little different. Finite cardinals match up with finite ordinals, but it gets different once you start with infinite cardinals. The first infinite cardinal ℵ₀ is the size of the (infinite) set of natural numbers - it is also the size of ω and ω + 1. But ℵ₀ + 1 = 1 + ℵ₀ = ℵ₀·2 = 2·ℵ₀ = ℵ₀. It is not until you try to do 2 ^ ℵ₀ that you get a bigger infinite cardinal. When people talk about "infinity" or use the symbol ∞, they are doing so in a loser sense - they just mean "bigger than anything finite", like a string of sausages that does not end. Don't worry is this is all beyond you - it is beyond most people who have not studied university level mathematics. It has no impact on practical programming (though infinities do turn up in the theory of computation, like the length of a Turing machine tape), and no impact on sausages. It would be nice, for a change, for you to accept that there really is mathematics beyond counting on your fingers and toes, and that it is both interesting and (at least sometimes) useful even if /you/ can't understand it. |
Paavo Helde <myfirstname@osa.pri.ee>: Dec 28 01:48AM +0200 On 28.12.2016 1:09, Stefan Ram wrote: > includes the possibility that consecutive read accesses > to the same uninitialized object may return different > values without any intervening write access to this object. AFAIK a C++ compiler can optimize away the whole 'if( x )x = 0;' clause because it relies on undefined behavior. Actually it might optimize away the whole program to int main() {} in case of UB but I guess the current compilers are not yet sophisticated enough for that. Maybe in 20 years when we have proper AI compilers... |
"Öö Tiib" <ootiib@hot.ee>: Dec 28 12:00AM -0800 On Wednesday, 28 December 2016 01:48:50 UTC+2, Paavo Helde wrote: > the whole program to int main() {} in case of UB but I guess the current > compilers are not yet sophisticated enough for that. Maybe in 20 years > when we have proper AI compilers... Yes, that is also sabotage by members of committee. Sane compiler would make best effort to announce about discovered undefined behavior and best effort to avoid making any "optimizations" because of discovered undefined behavior. |
"Öö Tiib" <ootiib@hot.ee>: Dec 27 11:36PM -0800 On Tuesday, 27 December 2016 20:03:37 UTC+2, Paavo Helde wrote: > thread-safe weak pointers, but such weak pointers are not compatible > with internal reference counters (a race condition between weak pointer > mechanisms and the object destructor). One can use 'std::enable_shared_from_this' together with 'std::make_shared' to get close to internal reference counter. The drawback there is that object will be destroyed when shared count reaches zero but the memory will be deallocated only when weak count also reaches zero. |
xerofoify <xerofoify@gmail.com>: Dec 27 08:31PM -0800 Either I am doing something very stupid or this is working and the tester I am using is wrong: template <class TYPE> HashTable<TYPE>::HashTable(const HashTable<TYPE>& other) { table_ = new Record*[other.cap]; size_ = other.size_; hash = other.hash; cap = other.cap; std::cout << cap << size_ << "\n"; for (int i = 0; i<other.cap_; i++) { if (table_[i] == nullptr) { continue; } update(other.table_[i]->key_,other.table_[i]->data_); } } //Updates record with the string passed to the new data for the record's data element and returns true if found/updated otherwise false template <class TYPE> bool HashTable<TYPE>::update(const string& key, const TYPE& value) { int hashvalue = hash(key) % cap; Record* prev = nullptr; Record* entry = table_[hashvalue]; while (entry != nullptr && entry->getKey() != key) { prev = entry; entry = entry->getNext(); } if (entry == nullptr) { entry = new Record(key, value); if (prev == nullptr) { // insert as first bucket table_[hashvalue] = entry; } else { prev->setNext(entry); } } else { // just update the value entry->setData(value); } size_++; return true; } |
Ian Collins <ian-news@hotmail.com>: Dec 28 05:36PM +1300 On 12/28/16 05:31 PM, xerofoify wrote: > Either I am doing something very stupid or this is working and the tester I am using is wrong: In neither of your postings did you define "not working". -- Ian |
xerofoify <xerofoify@gmail.com>: Dec 27 08:50PM -0800 On Tuesday, December 27, 2016 at 11:36:52 PM UTC-5, Ian Collins wrote: > In neither of your postings did you define "not working". > -- > Ian It does not pass the tester as one idea is not there after coping it over. I can't see how as update itself works but not in the for loop. |
xerofoify <xerofoify@gmail.com>: Dec 27 08:53PM -0800 On Tuesday, December 27, 2016 at 11:36:52 PM UTC-5, Ian Collins wrote: > In neither of your postings did you define "not working". > -- > Ian Basically the tester is not finding one pair correctly even through update passes its test. I am wondering how the for loop does not work as update itself clearly does. |
xerofoify <xerofoify@gmail.com>: Dec 27 08:33PM -0800 template <class TYPE> HashTable<TYPE>::HashTable(const HashTable<TYPE>& other) { table_ = new Record*[other.cap]; size_ = other.size_; hash = other.hash; cap = other.cap; std::cout << cap << size_ << "\n"; for (int i = 0; i<other.cap_; i++) { if (table_[i] == nullptr) { continue; } update(other.table_[i]->key_,other.table_[i]->data_); } } //Updates record with the string passed to the new data for the record's data element and returns true if found/updated otherwise false template <class TYPE> bool HashTable<TYPE>::update(const string& key, const TYPE& value) { int hashvalue = hash(key) % cap; Record* prev = nullptr; Record* entry = table_[hashvalue]; while (entry != nullptr && entry->getKey() != key) { prev = entry; entry = entry->getNext(); } if (entry == nullptr) { entry = new Record(key, value); if (prev == nullptr) { // insert as first bucket table_[hashvalue] = entry; } else { prev->setNext(entry); } } else { // just update the value entry->setData(value); } size_++; return true; } No idea why the constructor isn't working. Does anyone here have any ideas. |
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