- Jerry Stuckle - 1 Update
- Derivation without size increase? - 3 Updates
- Unit testing (Re: Putting project code in many different files) - 5 Updates
- February meetings - 2 Updates
- Making all getters- return values const? - 7 Updates
- Cross-platform C++ GUI Library -- coming soon! - 5 Updates
- Commenting code considered harmful - 2 Updates
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Feb 05 03:32PM Who is this Jerry Stuckle guy? He is giving me a headache. /Flibble |
Marcel Mueller <news.5.maazl@spamgourmet.org>: Feb 05 03:43PM +0100 On 04.02.16 21.40, Paavo Helde wrote: > // ... > }; > The size of B is not 24 or 25, but 32, because alignment. You are on a 64 bit platform? I would have expected 28 otherwise. > created and processed as well, I would not like to waste space and > performance just because of that. How to have a clean solution in C++ > without increasing the size of objects? #pragma pack does the magic for me: #include <stdio.h> #pragma pack(1) class A { double x[2]; char buffer[6]; char tag; // ... }; class B { A base; char anotherTag; public: B(A arg, char type): base(arg), anotherTag(type) {} // ... }; int main() { printf("%i\n", sizeof(B)); return 0; } => 24 > My current solution is to derive B from A and put 'protected char > anotherTag;' in A, where it is not initialized or accessed; it is only > initialized and accessed by Derived constructors and member functions. This is an option. > However, this creates a data member in A which is totally unneeded and > unused. Is there a better solution? Does your platform support #pragma pack? Since A is a POD you could also use offsetof to find the amount of free space in A. Marcel |
"Öö Tiib" <ootiib@hot.ee>: Feb 05 07:28AM -0800 On Friday, 5 February 2016 16:43:58 UTC+2, Marcel Mueller wrote: > return 0; > } > => 24 Yes, but that is typical best case test. Add those lines to your 'main': printf("%i\n", (int)sizeof(A)); A c[2]; printf("%i\n", (int)sizeof c); That results likely with 23 and 46 there. So making array of 'A'-s will get your 'A::x' single byte aligned. It may cause performance drop (needs profiling) that OP does not want. |
Jerry Stuckle <jstucklex@attglobal.net>: Feb 05 10:32AM -0500 On 2/4/2016 3:40 PM, Paavo Helde wrote: > }; > However, this creates a data member in A which is totally unneeded and > unused. Is there a better solution? Exactly how many are "zillions"? Even if you have 1,000,000 of them at the same time (very doubtful - trying to process that many items would take a lot of time), you're only talking about 8 MB of additional memory. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ================== |
Robert Wessel <robertwessel2@yahoo.com>: Feb 04 06:18PM -0600 On Thu, 4 Feb 2016 02:40:49 -0800 (PST), 嘱 Tiib <ootiib@hot.ee> wrote: >those people but Jerry is rare non-failing example. However I suspect >that he is now violating some NDA by spreading the business secrets >here. VSS was replaced with TFS a decade ago. It's long dead, and it's problems with it (although the last release did seem pretty solid). TFS even interfaces to Git these days. |
Jerry Stuckle <jstucklex@attglobal.net>: Feb 04 08:18PM -0500 On 2/4/2016 7:18 PM, Robert Wessel wrote: > VSS was replaced with TFS a decade ago. It's long dead, and it's > problems with it (although the last release did seem pretty solid). > TFS even interfaces to Git these days. Shhh. Don't burst his bubble! -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ================== |
Robert Wessel <robertwessel2@yahoo.com>: Feb 05 02:19AM -0600 On Thu, 4 Feb 2016 20:18:07 -0500, Jerry Stuckle >> problems with it (although the last release did seem pretty solid). >> TFS even interfaces to Git these days. >Shhh. Don't burst his bubble! Actually my comment reinforces his position, not yours - VSS is about the only VCS with significant use where corrupted repositories were common, and it's not an issue any more. And how did you escape my kill file? |
Paavo Helde <myfirstname@osa.pri.ee>: Feb 05 01:20PM +0200 On 4.02.2016 16:38, Jerry Stuckle wrote: > They have their own problems - the first being security. The more > systems you have involved, especially in remote locations, the less > secure you are. What do you mean be security? Are you afraid that a laptop gets lost or hacked and your valuable software is stolen? Do not worry, nobody wants to do anything with your software which only runs on mainframes and which has been implemented in those few spare moments your 30 developers were able to find between endless meetings and fighting other corporate obstacles. Only other similar companies might be interested, but they are too busy restoring their repos from tapes. > and can't be fixed for several days? Few companies can afford multiple > physical communications links from multiple providers, each link taking > a different physical path once it leaves the building. And how do you propose restoring anything from your backups over the broken link? With a distributed SCM all developers can just carry on as usual, just merging the repos is delayed until the network comes back. > There is no failsafe system. Even full backups, shipped off-site as > soon as they are taken (physically or via network) can have problems, > but they are still the surest form of restoring a failed system. Nope, 30 clones of a distributed SCM repo all over the world is by far more fail-safe than an off-site backup in a bank vault. Let's say a chance to lose a repo on a remote laptop is once per year. The probability to happen it in a given week is then 1/50 = 0.02. I choose a week because in a week the developer should get it working again, cloning the repo from another developer. Now, the probability to lose all 30 repos in a given week, assuming that the events are independent, is 0.02^30 = 1e-51. Let's say a bank vault can stay intact for a billion years (a clear exaggeration). The probability to lose it in a given week is then 1/(10^9*50) = 2e-11. You see that it is 1e40 times more probable to lose the bank vault. Of course the assumption that all laptop losses are independent is not correct. However, already 7 independent locations (like 6 people working from home at any given day) beat the billion-year-bank vault. > That's > why every big company does it that way. And every properly managed > project does, also. The big companies do it because this was the best practice 30 years ago, plus they don't trust their workers and attempt to control everything centrally. |
Jerry Stuckle <jstucklex@attglobal.net>: Feb 05 10:28AM -0500 On 2/5/2016 6:20 AM, Paavo Helde wrote: > obstacles. > Only other similar companies might be interested, but they are too busy > restoring their repos from tapes. The more systems you have the code stored on, the more people who have access to that code. And the vast majority of leaks start with someone having access. And I said nothing about my software running only on mainframes. I just challenged the comment that "no one develops on mainframes any more". It shows just how out of touch with the real world you and many others in this newsgroup are. You think the whole world is groups of two or three people working on PCs go develop your little crap no one else wants. It's not. And those 30 developers created more profit in a year than every person in this thread will create in their lifetimes. The projected value of the software is in the hundreds of millions of dollars. > And how do you propose restoring anything from your backups over the > broken link? With a distributed SCM all developers can just carry on as > usual, just merging the repos is delayed until the network comes back. That's my question to you. How do they carry on when they can't access the repo? >> but they are still the surest form of restoring a failed system. > Nope, 30 clones of a distributed SCM repo all over the world is by far > more fail-safe than an off-site backup in a bank vault. And hugely less secure. Why do you think the tapes are stored in a bank vault? > again, cloning the repo from another developer. Now, the probability to > lose all 30 repos in a given week, assuming that the events are > independent, is 0.02^30 = 1e-51. You don't need to lose all of the repos. Just one is enough. And if the chance of losing a laptop once per year, the chance of losing one of 30 laptops rapidly approaches unity. > exaggeration). The probability to lose it in a given week is then > 1/(10^9*50) = 2e-11. You see that it is 1e40 times more probable to lose > the bank vault. And the chances of you being killed by a meteor are greater than that of winning the Irish Sweepstakes. No, figures don't lie. But liars can figure. > The big companies do it because this was the best practice 30 years ago, > plus they don't trust their workers and attempt to control everything > centrally. The big companies do it that way because it is STILL the best practice. They know that - better than some programmer with no experience in real managed projects. But once again I've tried to teach a pig to sing. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ================== |
Geoff <geoff@invalid.invalid>: Feb 04 05:39PM -0800 >section and mention that they may no longer be >meeting. Besides Washington, DC what others do you >think are no longer meeting? You would be well advised to follow the links for those groups on that web link you posted. The D.C. Meetups link is a dead link to the root page of the Meetups site. If the group organizers can't be bothered to keep their calendars updated I' say it's not worth listing anywhere. |
Jerry Stuckle <jstucklex@attglobal.net>: Feb 05 10:16AM -0500 On 2/4/2016 8:39 PM, Geoff wrote: > web link you posted. The D.C. Meetups link is a dead link to the root > page of the Meetups site. If the group organizers can't be bothered to > keep their calendars updated I' say it's not worth listing anywhere. Geoff, it's not that they don't keep their calendars updated. They stopped meeting at least two years ago. There's no calendar to update. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ================== |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Feb 05 12:53AM +0100 On 2/4/2016 5:57 PM, JiiPee wrote: > }; > it should be: > const string getName() const { return m_name; } Like Victor, I suspect that you've inadvertently omitted an "&" here. But maybe not, it depends when this was written. Anyway, the "get" prefix is negative value verbiage in C++, I'm surprised Herb used it. > So preventing this kind of "error" use. I kind of agree, but do you > people also think that all getters should be done like this (if they > return an temporary object)? This was once recommended by Scott Meyers. Then came move semantics, and Andrei Alexandrescu declared that advice dead (actually, as I recall, that was /before/ C++11, just with Andrei's own C++03-compatible move semantics scheme called Mojo). There was a slightly memorable quote that I don't recall, but anyway, if you make the return value `const` then it can't be efficiently moved from, so that's ungood. > I do not see class makers doing this consistently. For modern coding it would be a sign of UNREASONED coding, actively doing additional needless and generally negative value things because one has seen it somewhere, associated with some measure of authority, without understanding it or reasoning about it. But before C++11 it could be good practice. Cheers & hth., - Alf |
JiiPee <no@notvalid.com>: Feb 05 01:47AM On 04/02/2016 22:45, Victor Bazarov wrote: >> const string getName() const { return m_name; } > Are you sure you didn't miss the reference indicator, like > const string& getName() const { return m_name; } No I did not. Sutters example is not the same though, but similar: const Complex operator++(int) { Complex temp(*this); ++*this; return temp; } but his reasoning is the same as what I said. ok, my example is not best becouse we could use ref there for sure,,, but how about looking at Sutters code? |
JiiPee <no@notvalid.com>: Feb 05 01:50AM On 04/02/2016 23:53, Alf P. Steinbach wrote: >> it should be: >> const string getName() const { return m_name; } > Like Victor, I suspect that you've inadvertently omitted an "&" here. ok, my example was not the best, but there is a better example in my Victors asnwer. > But maybe not, it depends when this was written. > Anyway, the "get" prefix is negative value verbiage in C++, I'm > surprised Herb used it. its mine.... > slightly memorable quote that I don't recall, but anyway, if you make > the return value `const` then it can't be efficiently moved from, so > that's ungood. ok, so not been able to move is worse than a danger that somebody does: a.getName() = "Peter"; |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Feb 05 03:59AM +0100 On 2/5/2016 2:50 AM, JiiPee wrote: >> efficiently moved from, so that's ungood. > ok, so not been able to move is worse than a danger that somebody > does: a.getName() = "Peter"; Yes, a restriction on useful and sometimes critical functionality is more important than preventing someone from doing a harmless silly thing. On a personal note, I never adopted the `const` return value convention in C++03, because I didn't see the point doing extra work and making the code more verbose in order to prevent a (as I saw it) non-problem. Scott Meyers made up for his (IMO) bad advice about result values, which was in the way of move semantics, by posting in this very group a critique of the then proposed rules for automatic generation of move constructors and assignment operators. He pointed out more situations where there was effectively a class invariant, and that a moved from object should always be destructible and, if previously assignable, still assignable (OK, a detail here or there may be wrong, I don't remember this exactly). As a result the proposed rules were changed. Cheers!, - Alf |
JiiPee <no@notvalid.com>: Feb 05 03:41AM On 05/02/2016 02:59, Alf P. Steinbach wrote: > As a result the proposed rules were changed. I guess the lesson is that do not read too carefully older C++ books |
SG <s.gesemann@gmail.com>: Feb 05 05:21AM -0800 On Friday, February 5, 2016 at 2:51:02 AM UTC+1, JiiPee wrote: > > that's ungood. > ok, so not been able to move is worse than a danger that somebody does: > a.getName() = "Peter"; In my opinion: yes. Like Alf, I also never adopted that rule even before move semantics. I didn't really see a need. But that was pretty much the only item from Meyers' Effective C++ book (I've read the 3rd edition) I disagreed with. Anyhow, C++11 allows you to have the cake and eat it to -- at least for your own custom types. So, you can get move semantics *and* avoid unwanted assignments to temporary objects. This is achieved via ref qualifiers: class Blah { public: Blah() = default; Blah(Blah const&) = default; Blah& operator=(Blah const&) & = default; // copy to lvalue Blah& operator=(Blah const&) && = delete; // copy to rvalue }; Another approach would be to use a static analyzer that warns about assignment to temporary objects. (I don't really know whether this is actually done by any of the available tools but I'm sure a tool like cppcheck can be easily changed to flag these kinds of assigments if this isn't already supported.) Cheers! sg |
"Öö Tiib" <ootiib@hot.ee>: Feb 05 07:14AM -0800 On Friday, 5 February 2016 05:41:19 UTC+2, JiiPee wrote: > On 05/02/2016 02:59, Alf P. Steinbach wrote: > > As a result the proposed rules were changed. > I guess the lesson is that do not read too carefully older C++ books On the contrary, read very carefully! Otherwise you may misunderstand. The book authors (I like Scott Meyers, Herb Sutter, Andrei Alexandrescu, Daveed Vandevoorde and Bjarne Stroustrup YMMV) describe what they think are more popular views, better patterns and safer idioms. Often their opinions overlap, sometimes contradict and like with any other person their opinions change over time. So nothing is holy truth just present experiences (at time of writing) of fellow programmer. You are the master so you decide what is in your toolbox and what is not ... there are no programming paradigms that C++ can not be made to support. |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Feb 05 12:09AM On 04/02/2016 22:22, Lynn McGuire wrote: >> /Flibble > Will it have X% of the functionality of wxWidgets? > https://www.wxwidgets.org/ I have never researched wxWidgets in any detail mainly because it appears to be an MFC rip off. > And a Mac / HTML version? HTML version? I may do a Kickstarter for a Mac version (mainly to fund me buying some Apple hardware). /Flibble |
krister alm <krister.alm@gmail.com>: Feb 04 11:35PM -0800 I do hope you wont fall into that old trap and implement your own standard components like most libraries seems to do. I will keep my eyes on this. One thing though, try keep the code in line with the standard or boost so if it is good it can be incoporated into a standard låter on. Keep up the good work. |
scott@slp53.sl.home (Scott Lurndal): Feb 05 02:24PM >http://neogfx.org >https://github.com/FlibbleMr/neogfx >/Flibble How is it better than the platform independent proposal for C++14? https://github.com/mikebmcl/N3888_RefImpl/blob/master/README.md If you need 3D, wouldn't it be better to extend N3888 instead of creating a new library? |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Feb 05 02:33PM On 05/02/2016 07:35, krister alm wrote: > I will keep my eyes on this. > One thing though, try keep the code in line with the standard or boost so if it is good it can be incoporated into a standard låter on. > Keep up the good work. Don't worry: Boost is a dependency and I am assuming C++11 as a minimum. The only custom containers I have are ones that the Std and Boost don't provide namely neolib::vecarray and neolib::segmented_array. /Flibble |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Feb 05 02:38PM On 05/02/2016 14:24, Scott Lurndal wrote: > https://github.com/mikebmcl/N3888_RefImpl/blob/master/README.md > If you need 3D, wouldn't it be better to extend N3888 instead of > creating a new library? A 2D or 3D graphics library and a GUI library are two quite different beasts. My GUI library currently uses SDL as a back-end but there is no reason why it couldn't use a different back-end such as N3888 as long as it provides similar functionality to SDL. As far as standardizing 3D in C++ is concerned I don't think it is warranted as OpenGL is perfectly adequate; people seemed to be obsessed with abstracting a C API into a C++ one for no good reason: nothing wrong with C APIs. /Flibble |
Ian Collins <ian-news@hotmail.com>: Feb 05 06:56PM +1300 Paavo Helde wrote: >> least one char from the input, and put the rest in workbuffer. But it >> looks wrong! > But you are missing a comment about using malloc()! Not to mention the missing cast... -- Ian Collins |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Feb 05 08:21AM +0100 On 2/5/2016 6:56 AM, Ian Collins wrote: > Paavo Helde wrote: >> But you are missing a comment about using malloc()! > Not to mention the missing cast... Assuming it's C code there should be no cast, and of course malloc is OK in C. Cheers & hth., - Alf |
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