- What is this constructor? - 2 Updates
- About placing member variable into a pure virtual base class - 7 Updates
- Abuse report of Rick C. Hodgin's spam - 4 Updates
- Allocating with new but freeing the memory with free - 1 Update
- [Jesus Loves You] I care for you - 6 Updates
- Different name for same function makes it harder to write templating code. - 4 Updates
- [OT] Fractals was Re: Good random number generators version 1.0, you can port it to C++ - 1 Update
woodbrian77@gmail.com: Oct 14 12:44PM -0700 I saw the following here: https://en.cppreference.com/w/cpp/language/noexcept_spec struct A{ A(int = (A(5),0))noexcept; A(const A&)noexcept; A(A&&)noexcept; ~A(); }; What is the first constructor doing? Thanks. Brian Ebenezer Enterprises - Enjoy programming again http://webEbenezer.net |
"Öö Tiib" <ootiib@hot.ee>: Oct 14 12:56PM -0700 > ~A(); > }; > What is the first constructor doing? Thanks. It is not known what the constructor is doing since definition of it has not been posted. The default argument to A(int) uses comma operator to achieve that temporary A with parameter 5 is constructed first. |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Oct 14 02:14AM +0100 On 14/10/2018 00:04, JiiPee wrote: > But its not 100% clear whether it should belong there or not....there > surely are many functions which we are not 100% sure if they belong to > this class interface or not. The term "interface" is already well defined in the C++ sense: it is a class that only contains pure virtual methods; there already exist terms for other things that are not exactly this. The main reason why this definition of the term "interface" pervades is because it closely resembles Java and C# interfaces however Microsoft probably first begat the term in the context of C++ when designing COM many years ago: the 'I' prefix of 'IUnknown' means "interface". /Flibble -- "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
bitrex <user@example.net>: Oct 13 11:52PM -0400 On 10/12/2018 05:11 AM, Bo Persson wrote: > possible choice is to be more pragmatic and not blindly follow the > rules/guidelines when they seem like a bad fit for the case at hand. > Bo Persson Otherwise pure virtual base classes seem to be a good place to put member variables for record keeping e.g. object counters that count how many of a given base type of object are in existence at a time if one needs that. or to generate unique identifiers/tags for a given object when its instantiated. There's no law that you can't combine static and dynamic polymorphism; you don't always need every base class pointer to be able to be used call all derived methods a subclass has, sometimes only a a subset need to be used that way. The rest of the polymorphic interface can be static done with say the CRTP. AFAIK there's no law that says pure virtual functions of the abstract base have to necessarily be overriden in the direct subclass. so you can have different implementations of FooImpl here for FooInterface, but even so "optional" can be inlined because it doesn't need to be called dynamic-polymorphically: #include <iostream> class FooBase { public: virtual ~FooBase() {} void required() { required_(); } protected: FooBase() = default; private: virtual void required_() = 0; }; template <typename Impl> class FooInterface : public FooBase { public: void required() { static_cast<Impl*>(this)->required_(); } void optional() { static_cast<Impl*>(this)->optional_(); } }; class FooImpl : public FooInterface<FooImpl> { friend class FooInterface<FooImpl>; protected: void optional_() { std::cout << "Optional\n"; } private: void required_() override { std::cout << "Required\n"; } }; int main() { FooBase* base_ptr = new FooImpl(); FooImpl* derived_ptr = new FooImpl(); base_ptr->required(); derived_ptr->required(); derived_ptr->optional(); } |
David Brown <david.brown@hesbynett.no>: Oct 14 12:39PM +0200 On 13/10/18 22:52, Juha Nieminen wrote: > class? In what situation could it even make that distinction, > even if for some unfathomable reason it would want to care > about the difference?) I think the biggest practical issue with "interface with member" classes is for multiple inheritance. When you have interface classes with only functions, it's no problem to inherit from several of them. If there are members, you need virtual inheritance (which is complicated and less efficient). |
"Öö Tiib" <ootiib@hot.ee>: Oct 14 04:39AM -0700 On Sunday, 14 October 2018 04:14:51 UTC+3, Mr Flibble wrote: > The term "interface" is already well defined in the C++ sense: it is a > class that only contains pure virtual methods; there already exist terms > for other things that are not exactly this. The term "interface" is terribly overused in various senses and in all programming including in C++. Rather typical is (for example) a discussion what is better "interface" A or B: auto p1 = geometry::perimeter(circle); // A auto p2 = circle.perimeter(); // B |
JiiPee <no@notvalid.com>: Oct 14 01:32PM +0100 so can you give and example how to change that Animal class not to place the data there |
Thiago Adams <thiago.adams@gmail.com>: Oct 14 11:07AM -0700 On Saturday, October 13, 2018 at 2:03:30 PM UTC-3, Öö Tiib wrote: > > or cat memory . I cannot instantiate an Animal object, just a pointer. > That concern is also already solved since one can certainly use > std::variant<Dog*,Cat*> if they so wish. I think it is better to have the information about the type inside the object (like vtable does) instead of having it inside the reference to the object (like std::variant<Dog*,Cat*> does). I have used this pattern (tag inside the object) in my parser AST. I have two data structures pointing to the same object. I have map that maps string->object and I have a tree to walk and find declarations. If I had used something like std::variant<Dog*,Cat*> (have a tag inside) then I would ended using more memory compared with raw pointers pointing to the object that have the 'tag' inside. map<string, std::variant<Dog*,Cat*>> vector<std::variant<Dog*,Cat*>> instead of map<string, Animal*> vector<Animal*> So, I think std::variant is not ideal in this case. I think it was created to be used like tagged unions, like COM variant. Using C++ and maybe some techniques used in std::variant it is possible to create something useful before to have it inside the language. I did this sample in 2014 http://thradams.com/dynamic_select.htm I have dynamic_select and typeid is used. std::vector<std::unique_ptr<object>> v; v.emplace_back(new box()); v.emplace_back(new circle()); for (auto& item : v) { dynamic_select<box, circle>(item.get(), [](auto a) { draw(a); }); } I believe some support from the language would be interesting. I have considered to use union Shape { Box * pBox; Circle* pCircle; }; to say I have a pointer to box or circle. But to use this data struct the code was very confusing (like to create an out pointer) and the chances to create error was too big. |
"Öö Tiib" <ootiib@hot.ee>: Oct 14 12:11PM -0700 On Sunday, 14 October 2018 21:07:13 UTC+3, Thiago Adams wrote: > So, I think std::variant is not ideal in this case. > I think it was created to be used like tagged unions, like > COM variant. Like every tool variant is also not silver bullet. Sometimes run-time polymorphism is best through virtual functions, sometimes it is best using visitor pattern and sometimes it is best using variants. I still do not understand in what context your idea is better from those others. > But to use this data struct the code was very > confusing (like to create an out pointer) and > the chances to create error was too big. The dynamic dispatch through typeid works only with classes that have virtual functions. In actual programs such types with virtual functions seem more rare than other types. Also, if you have to have virtual functions and have to check typeid through vtable then how it can be better than just to use the virtual functions? |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Oct 14 04:35PM +0100 Hi, I tried e-mailing Google Group's abuse e-mail "groups-abuse@google.com" and I got the following most unsatisfying automated reply: Hello leigh@i42.co.uk, We're writing to let you know that the group you tried to contact (groups-abuse) may not exist, or you may not have permission to post messages to the group. A few more details on why you weren't able to post: * You might have spelled or formatted the group name incorrectly. * The owner of the group may have removed this group. * You may need to join the group before receiving permission to post. * This group may not be open to posting. If you have questions related to this or any other Google Group, visit the Help Center at https://support.google.com/a/google.com/bin/topic.py?topic=25838. Thanks, google.com admins ----- Original message ----- X-Google-Smtp-Source: ACcGV61u+/LaPushl2LJi6RWZR55/4yXqUnnNsQiTUGS/Q+a4/mAvHA7DM/9L/txq3y+GMBtAal/ X-Received: by 2002:adf:dd83:: with SMTP id x3-v6mr11314529wrl.212.1539531098242; Sun, 14 Oct 2018 08:31:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539531098; cv=none; d=google.com; s=arc-20160816; b=LNLvRnsQXAC9NnHjIcc2v6XqKz/MVjbYkc3bIJcnRewKT17+CZXhXoYqbFLIMWUBD4 21TPChy8j3dfhtOjmYlvIyMHxURZgpw3GWjf6P4v9DKZvJlSyzCTAonXydIYnVliKfMs 3QUa2E3IJmTRDNMGzKaYWA7Kq64RdpDgCVgT4b+iVpXMJ2haIKj2CUU3GS44Wzs4vcmh YJLJPcqrNlHXA5arEQ3s1eSBm4Us/lrQ60mL6ggf9ZH9gE19zHiP9UPvMdnJcWpV65KX 7kSVyiMhzddG9MF/tgFG15GsUbnLfhgnZkofTPWwzaNxI6zGRMx7KA5JRcPQ826rf5kQ TJtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-language:mime-version:user-agent:date:message-id:subject :from:to; bh=Vh/YjK8r/kWOhdQBlF1BvXR8naMX7JhIGEKYtksEvbk=; b=FXx+cM0HB9et+BI+k16ci/cssXNkQveLgHiOgBrQlRRPJ1/ohyqctwHZ0QQHOL7ybE jx8uXtpRUcBWvZisl93aOA3FhIYwOAq59uXE+CW2d9aeKrps+eGnMzQcdtECiuvsddE3 WmRuXbO+oABur7XDjybo6cVl+7Kep+2eszWBwlFWDPKMBg5eTjpdkAaRMOOvaYvfGxIU b5+/jYEcU0VMOZIcMQcNgnXR9VMYxvbPStRA4tMfdNJdzDTU7hvX5l6e/IMRjRSswG/p dOKHwedhZDtXPg08Zo8fQmAgc7uIurbnuld7dDTViYPtIjJQhrNiiNnowEUI48/HTFFa R00A== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 94.136.40.62 is neither permitted nor denied by best guess record for domain of leigh@i42.co.uk) smtp.mailfrom=leigh@i42.co.uk Return-Path: <leigh@i42.co.uk> Received: from mailex.mailcore.me (mailex.mailcore.me. [94.136.40.62]) by mx.google.com with ESMTPS id y9-v6si5838654wrn.359.2018.10.14.08.31.37 for <groups-abuse@google.com> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Oct 2018 08:31:38 -0700 (PDT) Received-SPF: neutral (google.com: 94.136.40.62 is neither permitted nor denied by best guess record for domain of leigh@i42.co.uk) client-ip=94.136.40.62; Authentication-Results: mx.google.com; spf=neutral (google.com: 94.136.40.62 is neither permitted nor denied by best guess record for domain of leigh@i42.co.uk) smtp.mailfrom=leigh@i42.co.uk Received: from [2.216.215.188] (helo=[10.0.0.142]) by smtp04.mailcore.me with esmtpa (Exim 4.89) (envelope-from <leigh@i42.co.uk>) id 1gBiMj-00075C-8A for groups-abuse@google.com; Sun, 14 Oct 2018 16:31:37 +0100 To: groups-abuse@google.com From: Leigh Johnston <leigh@i42.co.uk> Subject: Rick C. Hodgin's off topic spam to comp.lang.c++ Message-ID: <cc989dbc-1dfc-4214-53c9-bfa85052ca1d@i42.co.uk> Date: Sun, 14 Oct 2018 16:31:39 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------56BDC9BA49730D7BC8AD0D0C" Content-Language: en-GB X-Mailcore-Auth: 8415251 X-Mailcore-Domain: 193285 X-KLMS-Rule-ID: 1 X-KLMS-Message-Action: clean X-KLMS-AntiSpam-Status: not scanned, license restriction X-KLMS-AntiPhishing: not scanned, license restriction X-KLMS-AntiVirus: Kaspersky Security 8.0 for Linux Mail Server, version 8.0.1.721, bases: 2018/10/14 08:42:00 #8697624 X-KLMS-AntiVirus-Status: Clean, skipped This is a multi-part message in MIME format. --------------56BDC9BA49730D7BC8AD0D0C Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hello, I am writing to report the repeated and systematic abuse of the Usenet group *comp.lang.c++* by *Rick C. Hodgin* (*rick.c.hodgin@gmail.com*) using your Google Groups facility. Mr Hodgin repeatedly posts off topic religious posts to the group both as new topics and as replies to technical posts of others and is causing immense disruption to the group. Please would you warn Mr Hodgin to cease and desist and if he fails to do so please could you take further action? Regards, Mr Leigh Johnston C++ Software Engineer. --------------56BDC9BA49730D7BC8AD0D0C Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> </head> <body text="#660000" bgcolor="#FFFFFF"> <p><font size="-1"><font face="Consolas">Hello,</font></font></p> <p><font size="-1"><font face="Consolas">I am writing to report the repeated and systematic abuse of the Usenet group <b>comp.lang.c++</b> by <b>Rick C. Hodgin</b> (<b><a class="moz-txt-link-abbreviated" href="mailto:rick.c.hodgin@gmail.com">rick.c.hodgin@gmail.com</a></b>) using your Google Groups facility.</font></font></p> <p><font size="-1"><font face="Consolas">Mr Hodgin repeatedly posts off topic religious posts to the group both as new topics and as replies to technical posts of others and is causing immense disruption to the group.</font></font></p> <p><font size="-1"><font face="Consolas">Please would you warn Mr Hodgin to cease and desist and if he fails to do so please could you take further action?</font></font></p> <p><font size="-1"><font face="Consolas">Regards,</font></font></p> <p><font size="-1"><font face="Consolas">Mr Leigh Johnston<br> C++ Software Engineer.<br> </font></font></p> </body> </html> --------------56BDC9BA49730D7BC8AD0D0C-- |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 14 08:50AM -0700 On Sunday, October 14, 2018 at 11:35:54 AM UTC-4, Mr Flibble wrote: > and I got the following most unsatisfying automated reply: > Hello leigh@i42.co.uk, > [snip] It's very frustrating to report spam to a source and have it fall on deaf ears, isn't it, Leigh? I reported your messages over 20 times before there was any move- ment, and I'm almost positive it only moved because other people reported it who weren't me. I will abide by the decision of Google. When I am banned, that will be fine by me. I am a witness for Jesus Christ in this world, in this world that does not know, acknowledge, or love Jesus as He deserves to be known, acknowledged, and loved in the daily as- pects of our lives. It is only natural the unsaved run from Him, but this message is not for those who won't be saved, but is only for those who will be saved. And if I knew who those people were, or when they would be saved, I would save the effort, and focus in only on them, and only during the time they would be saved. But I don't know that information. No one does. So, we blanket everyone, knowing that God desires to save everyone, and makes His salvation available to everyone, so that only those who truly rebel against Him both originally because of sin, and in all of the times they hear Him calling on the inside, only then will they send themselves to Hell. ----- You are angry with me, Leigh, because deep down you know I am teaching you the truth. And deep down you love sin more than you love God, so you are content to reject eternity for your sinful pleasures for this brief tick of the clock here on Earth. It is a poor decision, and it will cost you everything forever. I would save you from that, but you'll just post "[tl;dr]" as you plow forward to Hellfire. -- Rick C. Hodgin |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Oct 14 05:01PM +0100 On 14/10/2018 16:35, Mr Flibble wrote: > https://support.google.com/a/google.com/bin/topic.py?topic=25838. > Thanks, > google.com admins [snip] I've logged into Google Groups and reported his last religious post for abuse (spam). Could others do the same please? A concerted effort may result in Google doing something to ban this idiot. /Flibble -- "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Oct 14 05:36PM +0100 On 14/10/2018 16:50, Rick C. Hodgin wrote: > On Sunday, October 14, 2018 at 11:35:54 AM UTC-4, Mr Flibble wrote: [snipped tl;dr] > teaching you the truth. And deep down you love sin more than you > love God, so you are content to reject eternity for your sinful > pleasures for this brief tick of the clock here on Earth. No I am not angry with you I am just irritated by your off topic proselytizing spam in this technical newsgroup, no more no less. What I believe "deep down" is exactly the same as what I believe "on the surface" which is that your god doesn't exist (actually I know this for a fact I don't simply "believe" it) and that you are a fucking retard. /Flibble -- "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
Manfred <noname@add.invalid>: Oct 14 05:50PM +0200 On 10/13/2018 4:24 AM, Alf P. Steinbach wrote: > one may have to pass a `new`-allocated thing to a C routine that will > `free` whatever it gets, and for efficiency avoid an extra `malloc` + > copying. Then one may decide to go with one of the two last points. I am with Öö here, I have never gone this way in production code, and I am confident I never will - it is just waiting for trouble to happen. By the way, there are not many C routines that do `free` on what they get, and typically they are meant to be paired with other routines that do `malloc` the appropriate object (an example is getaddrinfo/freeaddrinfo). It is much too better to properly adjust the code, even if this means to not call the "C routine that will `free` whatever it gets" and reimplement it myself. In my experience I even happened to encounter trouble with code where some object was allocated with `new` in application code and freed with `delete` by a library, so forcing `new` and `free` to pair would be a no-go for me. But > I think that should be documented: "NOTE: NOT USING STRDUP BECAUSE > MEASUREMENTS SHOWED THAT WAS TOO SLOW, AND BORKA C++ NEW /IS/ MALLOC". This wouldn't be a 'should', it'd be a *must* instead, possibly integrated with apologies in advance for the future maintainers... |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 14 02:32AM -0700 Go to church today. Learn about who Jesus is to you. Learn about why you need Him to forgive your sin. I'm seeking to live my life in service to The Lord Jesus, who is the Christ (the savior of mankind). I seek to do this in hardware and software. And I seek to encourage you to do the same in the things you do. Won't you join me in serving The Lord with your life, your skills, your talents? Won't you honor God in all the things you do, for He loves you greatly, and calls you to truly great things. Give back to Him the fruits of what He first gave to you (your talents, abilities, opportunities, influences, knowledge, experiences, and passions). Acknowledge Him as He truly is, and feel that inner love, joy, peace, and happiness continually ... even in the midst of your struggles. -- Rick C. Hodgin |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Oct 14 01:51PM +0100 On 14/10/2018 10:32, Rick C. Hodgin wrote: [off topic spam snipped] Stop spamming this technical newsgroup spammer. I will report this to Google. /Flibble -- "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 14 07:10AM -0700 On Sunday, October 14, 2018 at 8:51:37 AM UTC-4, Mr Flibble wrote: > Stop spamming this technical newsgroup spammer... ^^^^ Remember this claim on the Day it will become the most important thing to you. Then you will know the truth. Then you will change your tune. -- Rick C. Hodgin |
gazelle@shell.xmission.com (Kenny McCormack): Oct 14 02:34PM In article <eZGwD.92780$tq.3699@fx01.fr7>, >On 14/10/2018 10:32, Rick C. Hodgin wrote: >[off topic spam snipped] >Stop spamming this technical newsgroup spammer. I will report this to Google. I think Rick's fundamental problem is that he's never cracked the book on the documentation for his newsreader. As a result, he doesn't know how to specify which newsgroup is the target of his post. He doesn't seem to know how to post religious posts to religious groups - and thus they seem to end up in either comp.lang.c or this one. Somehow, he has figured out how to post to the C groups; he seems to have figured that out through trial-and-error. In fact, I think this describes Rick's general approach to computing. He's just not a book-learning kind of guy - he just kinda feels his way through it, picking up odd ideas and odd skills here and there - sorta like how most people learn, say, Excel. You can see this in the posts regarding the "CAlive" thingie - and all its related stuff. It's like the classical story of the blind men and an elephant. And, in case you think I'm just slagging him, remember that Rick has said exactly these things in his own posting history. He's made it clear that he doesn't like books - basically, because of his learning disabilities, he can't really read - so he rarely reads technical documentation of anything. And, so keep in mind, that classical religion pretty much maintains that reading anything other than the Bible is sinful, so it makes sense that he'd want to steer clear of it. -- https://en.wikipedia.org/wiki/Mansplaining It describes comp.lang.c to a T! |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 14 08:03AM -0700 On Sunday, October 14, 2018 at 10:34:19 AM UTC-4, Kenny McCormack wrote: > ... [Rick] doesn't know how to specify which newsgroup is the > target of his post. He doesn't seem to know how to post religious > posts to religious groups... What you do not grasp, Kenny, is that Jesus came to save all people. This includes the people that do not go to religious groups, or to any religious activities, etc. What Jesus offers is salvation from sin and eternal life. He offers this to all people who will be saved. His blood was shed for all those who will be saved, but not one drop of blood was shed for those who won't. You do not realize that Jesus cares about all people ... not just those who go to religious groups. His primary mission in this world is outreach to the lost, because the saved have already been saved, and His Holy Spirit guides each of those who are saved continually to do more and more outreach. Someday you'll know the truth, Kenny. I pray for your sake it's sooner, rather than later. It will end much better for you if you realize you do have sin, that sin costs you your soul, and that God Himself came here to this Earth to give you a way out of that literal DEAD-end street you're on. Would you now like to reply with some attacking, mocking post and signature line that you think is so funny, but is really just spew- ing hurt and hate upon yourself and all people who encounter it? Or are you ready for a new chapter in your life, one where you seek to learn the truth for real? -- Rick C. Hodgin |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 14 08:17AM -0700 On Sunday, October 14, 2018 at 10:34:19 AM UTC-4, Kenny McCormack wrote: > most people learn, say, Excel. You can see this in the posts regarding the > "CAlive" thingie - and all its related stuff. It's like the classical > story of the blind men and an elephant. What I have said is I have difficulty reading complex things. In most cases I am able to find the content online, copy-and-paste into a reader which then does text-to-speech for me so I can hear it. Then I grasp it far more easily, and can often read along with what I hear. It's from dyslexia. It's not a lackadaisical attitude toward read- ing. It's a legitimate impediment. And I do read. It just requires my full concentration and is very tiring, a very difficult thing for me to do. And, I do make a lot of mistakes when I read only. > And, in case you think I'm just slagging him, remember that Rick has said > exactly these things in his own posting history. He's made it clear that > he doesn't like books I have never said I don't like books. I have said that I prefer to watch videos, or listen to sources rather than reading, and at a rate of probably 50:1 because it's much easier for me. I don't have any impediments at work when I hear things, only when I read. > - basically, because of his learning disabilities, he > can't really read - so he rarely reads technical documentation of anything. Again, not true. I read a lot of technical documentation. The things I have posted specifically about me begin against are things written like the C Standard. It reads like legalese to me, and I cannot understand it. Over time, as I see little bits posted here and there, I am understanding more of it, but when I go to try and find something in it, it makes no sense to me. But by comparison, I am studying the OS/2 kernel presently, and am going through all of the technical documentation regarding OS/2's full API. I plan to begin a project to create a new open- source OS/2 called ES/2 beginning in late 2019 or early 2020, after CAlive is completed and released. This requires a tremendous amount of technical reading, and is very difficult for me to do, so I'm doing it piecemeal, and am re-writing it into the ways I think when I encounter the various parts, so in the end I will have documentation written in the way I can use it, rather than in the way it was written by others. > And, so keep in mind, that classical religion pretty much maintains that > reading anything other than the Bible is sinful, so it makes sense that > he'd want to steer clear of it. Classical "religion" refers to any type of religion. What you mean here is "Christianity" maintains that the Bible is the true authority, and that other sources are not to be trusted when they espouse something contrary to the Bible. For example, if you read only Genesis 1 you will find that God explains completely clearly how He created everything, and made each thing after its kind from inception, meaning evolution does not exist, that all of life including us was created, and we are not some cosmic accident, but we were purposefully tailored to by a loving God who seeks an eternal relationship with us. He's literally made us to be with Him in eternity, made in His own imagine and likeness. We are literally as He is. We are not Him, but are like Him, just as you are like your parents, but you are not your parents. ----- None of this is a joke, Kenny. You turn toward mocking with nearly every post you write. Mocking Keith, Bart, me, and many other people on the things they write. It speaks to your very low sense of self-esteem that you have to demean others to try and make yourself seem higher in your mind. You do not realize that all you're doing is demeaning yourself, and bringing forth harm to others, making yourself judge and jury on the quality of people's thinking, their effort, their experience and train- ing, etc. It is in no way the proper way to be, and I truly pray that you will one day snap out of it and see and follow after the truth, because on that day you'll find the inner joy your life's been lacking probably since childhood. -- Rick C. Hodgin |
Paul <pepstein5@gmail.com>: Oct 14 02:11AM -0700 When implementing Depth First Search and Breadth First Search, it's extremely common to make the code for these algorithms the same, but to use a stack for DFS and a queue for BFS. Because the code is the same with only the data structures different, a templating approach seems natural. Doesn't the fact that queues have a front() but stacks have a top() make this templating unnecessarily difficult? And what is the standard workaround? I suppose a Top() function and template specializations where stack objects return top() and queue objects return front(). I don't know why these have different names but I'm sure there's a good reason for it. Paul |
Jorgen Grahn <grahn+nntp@snipabacken.se>: Oct 14 11:21AM On Sun, 2018-10-14, Paul wrote: > a templating approach seems natural. > Doesn't the fact that queues have a front() but stacks have a top() make > this templating unnecessarily difficult? And what is the standard workaround? I think the basic idea is, if two containers have different names for similar functions, it's because they are different enough to be non-interchangeable. You can, I believe, see the same thing in e.g. Python. > return top() and queue objects return front(). > I don't know why these have different names but I'm sure there's a good reason > for it. I think it's simply because a queue isn't a stack. /Jorgen -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o . |
"Öö Tiib" <ootiib@hot.ee>: Oct 14 04:26AM -0700 On Sunday, 14 October 2018 12:11:23 UTC+3, Paul wrote: > When implementing Depth First Search and Breadth First Search, > it's extremely common to make the code for these algorithms the > same, but to use a stack for DFS and a queue for BFS. Generic implementations of those algorithms are only part of true monsters like Boost.Graph. AFAIK non-recursive DFS of it uses vector, and BFS uses coloring with specially made visitor). Usually the algorithms are hand-tailored exactly for specific problem. Direct usage of std::vector, std::array, std::deque or boost::circular_buffer is frequent for actual implementations of those algorithms. Several of DFS that I've seen used std::priority_queue too. The reason is likely that interface of std::stack and std::queue makes it tricky to apply problem-specific heuristics, constraints and/or optimizations to these (usually performance critical) algorithms. The handiness for naive implementation matters less. > a templating approach seems natural. > Doesn't the fact that queues have a front() but stacks have a top() make > this templating unnecessarily difficult? No. The stack has only one end "top", queue has two ends: "back" and "front". > And what is the standard workaround? It is not so standard problem at all like you claim and the whole idea is generally not good. Not Good(TM). Trying to conflate two very different in actual implementations algorithms because rather naive implementations of those happen to be similar is actually rather confusing. > I suppose a Top() function and template specializations where stack objects > return top() and queue objects return front(). Ugh. Function templates can't be partially specialized, only fully. It is because functions have to overload. Class templates can be partially specialized. Otherwise such overloads are rather simple to write: template<class T, class C> std::queue<T, C>::reference pop_element(std::queue<T, C>&& queue) { return queue.front(); } template<class T, class C> std::queue<T, C>::const_reference pop_element(std::queue<T, C> const& queue) { return queue.front(); } template<class T, class C> std::stack<T, C>::reference pop_element(std::stack<T, C>&& stack) { return stack.top(); } template<class T, class C> std::stack<T, C>::const_reference pop_element(std::stack<T, C> const& stack) { return stack.top(); } Disclaimer: Did not bother to test so there can be typos. > I don't know why these have different names but I'm sure there's a good reason > for it. It is because programmers imagine queues as horizontal but stacks as vertical things. Therefore naming anything in queue as "top" or in stack as "front" would not make any sense and would just confuse people. It is also may be worth to note that all standard library std::stack implementations that I've seen use "back" of underlying container as "top" of stack. |
Ben Bacarisse <ben.usenet@bsb.me.uk>: Oct 14 01:52PM +0100 > return top() and queue objects return front(). > I don't know why these have different names but I'm sure there's a good reason > for it. I think it's just history and convention. In practical terms, you could use a deque in both cases and parameterise the search function with the member function to use to queue items. You can do this either as an actual function parameter or using a template. -- Ben. |
"Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid>: Oct 13 08:40PM -0700 On 10/10/2018 9:49 PM, Chris M. Thomasson wrote: > https://plus.google.com/101799841244447089430/posts/19LK2c9tv9i > https://plus.google.com/101799841244447089430/posts/hhVMw7eB2fx > They kind of look like some strange simulated Hubble images. Each pixel in the rendering is infinite. |
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