- enum type in template declaration - 1 Update
- issues with std::variant - 11 Updates
- What does the "L" mean - 4 Updates
- I'm not able to find the error - 1 Update
- Why enum is automatically converted in class member but not in global function - 1 Update
- A question about if constexpr - 3 Updates
- NIHS (Was: "Microsoft Exploring Rust as the Solution for - 1 Update
- std::atomic<T>::is_lock_free() - 1 Update
- two's complement idea - 1 Update
Soviet_Mario <SovietMario@CCCP.MIR>: Dec 05 11:20PM +0100 since what version of standard, if any, an ENUM type can be an argument of a template ? sth like enum RestrictedValues { A = 1, B = 2, C = 4, D = 8 }; template <RestrictedValues ttVal> class SizedField { private: unsigned char zzArray [ttVal]; public: etc etc } or if the syntax is wrong, how to workaround ? The goal is to have a template depending on a restricted well defined, and known at compile time, set of integral values -- 1) Resistere, resistere, resistere. 2) Se tutti pagano le tasse, le tasse le pagano tutti Soviet_Mario - (aka Gatto_Vizzato) |
Taylor <wtholliday@gmail.com>: Dec 05 12:48AM -0800 On Thursday, December 5, 2019 at 12:00:21 AM UTC-8, Öö Tiib wrote: > tell what members do make sense and what members don't. > 4) We get code-base with what work is possible to divide between contractors. > 5) There are nothing bleeding edge fancy about all of it. PolyCollection is cool and I appreciate the suggestion. Unfortunately, it alone doesn't have the structural sharing I need in order to implement undo/redo efficiently. I would probably have to use a memento pattern instead, which is error prone. |
Vir Campestris <vir.campestris@invalid.invalid>: Dec 05 03:07PM On 04/12/2019 21:34, David Brown wrote: > 5. If you are using Windows and have parallel builds and lots of files, > especially with gcc or clang, try Linux. If you are stuck with Windows, > try with an SSD instead of a hard disk. I'd try the SSD before I went to the pain of switching OS. (I still haven't found a Linux IDE as good as visual studio) Andy |
"Öö Tiib" <ootiib@hot.ee>: Dec 05 08:17AM -0800 On Thursday, 5 December 2019 10:48:18 UTC+2, Taylor wrote: > > 4) We get code-base with what work is possible to divide between contractors. > > 5) There are nothing bleeding edge fancy about all of it. > PolyCollection is cool and I appreciate the suggestion. Unfortunately, it alone doesn't have the structural sharing I need in order to implement undo/redo efficiently. I would probably have to use a memento pattern instead, which is error prone. I do not use Memento pattern ever. Memento had on 95% of cases when I met it started as naive, locally invented square wheel. Time had turned it into annoying spaghetti that just complicated everything. It was often misused for other somewhat similar purposes (like cut/copy/paste or drag and drop). As result over half of the issues in these projects were directly caused by that dreaded Memento. Why not to use serialization capabilities for most of such purposes? Everything worth undoing or rolling back wants soon to become something that is worth storing persistently and even worth transferring to far-away sites. There are literal piles of serialization libraries available (like Protobufs, Flatbuffers, Cereal, Cap'n Proto, Bond, Apache Avro, Thrift, MessagePack and just name it). The popular ones are done by good programmers, tested by lot of people and so tend to be adequate and far from naive. Pick one that is language- and platform-neutral ... that provides also wider opportunities of automatic black-box testing of your modules. ;) |
Taylor <wtholliday@gmail.com>: Dec 05 09:44AM -0800 On Thursday, December 5, 2019 at 8:17:37 AM UTC-8, Öö Tiib wrote: > people and so tend to be adequate and far from naive. Pick one > that is language- and platform-neutral ... that provides also wider > opportunities of automatic black-box testing of your modules. ;) I use Flatbuffers for serialization. It's pretty good. But it doesn't easily provide the structural sharing that I need to make undo/redo memory-efficient. For example, if my document contains large data (images, audio, etc.) I don't want to have to save that out after every user interaction. (I'm simplifying a bit: Flatbuffers is a DAG so it can express structural sharing, however I think it would be tricky to implement an efficient undo system with it.) I have another app which doesn't use structural sharing, and I had to lower the max undos, after some users complained (to put it mildly) about storage usage. |
Taylor <wtholliday@gmail.com>: Dec 05 09:59AM -0800 On Wednesday, December 4, 2019 at 8:13:24 PM UTC-8, Alf P. Steinbach wrote: > Re the problem you're asking about, it seems clear that there is some > commonality of the classes that has not been factored out / abstracted, > but that the rest of the code relies on. If I were to use inheritance to factor out commonality, I would need to use multiple inheritance and it could get messy. So for example, there's the base class Node, then there might be ExposedNode, and ColorfulNode, LabeledNode. Or I could use interfaces, such has HasExposedPosition, HasColor, HasLabel, etc. I did this before and it's much more code than the variant stuff. (And of course using virtual functions complicates the use of value types, since you need to avoid slicing.) The SFINAE thing (setExposedPosition) does this all in under 10 lines of code, and automatically works for any new type that has an exposedPosition attribute. It's pretty cool in that way. > static type information, replacing it with dynamic type information and > checking. A solution should involve not throwing away the static type > information, or at least throwing away less of it. And voilá. I'm not sure what information I'm throwing away there. Could you elaborate? thanks! |
Taylor <wtholliday@gmail.com>: Dec 05 10:01AM -0800 On Thursday, December 5, 2019 at 7:07:06 AM UTC-8, Vir Campestris wrote: > I'd try the SSD before I went to the pain of switching OS. > (I still haven't found a Linux IDE as good as visual studio) > Andy FWIW, my 2013 laptop already has a SSD. Thing is, this computer is fast enough for almost everything I do. So it would be good to save the money. |
"Öö Tiib" <ootiib@hot.ee>: Dec 05 11:14AM -0800 On Thursday, 5 December 2019 19:44:54 UTC+2, Taylor wrote: > > that is language- and platform-neutral ... that provides also wider > > opportunities of automatic black-box testing of your modules. ;) > I use Flatbuffers for serialization. It's pretty good. But it doesn't easily provide the structural sharing that I need to make undo/redo memory-efficient. For example, if my document contains large data (images, audio, etc.) I don't want to have to save that out after every user interaction. (I'm simplifying a bit: Flatbuffers is a DAG so it can express structural sharing, however I think it would be tricky to implement an efficient undo system with it.) Sounds again like some kind of straw-man argument ... who would serialize whole document to store erasure or change of one image? Only the state and location of image before change needs to be serialized for to be capable of restoring it. > I have another app which doesn't use structural sharing, and I had to lower the max undos, after some users complained (to put it mildly) about storage usage. No wonder. Look back at your OP. Should you replace unions of 68 classes with one class with all possible members in those classes? Uhh. I thought anyone wielding wasteful stuff like C# or Java half-decently or horrible stuff like Python or PHP expertly will beat C++ of that guy in all of clarity, maintainability, speed and storage usage. |
Taylor <wtholliday@gmail.com>: Dec 05 12:37PM -0800 On Thursday, December 5, 2019 at 11:14:39 AM UTC-8, Öö Tiib wrote: > whole document to store erasure or change of one image? Only the state and > location of image before change needs to be serialized for to be capable > of restoring it. Sure, I could serialize diffs, but with significant additional complexity (it's a bit close to the memento pattern). If you know of a way that flatbuffers makes that easier, that would be good to know. I couldn't find anything searching around. |
David Brown <david.brown@hesbynett.no>: Dec 05 10:15PM +0100 On 05/12/2019 16:07, Vir Campestris wrote: >> files, especially with gcc or clang, try Linux. If you are stuck with >> Windows, try with an SSD instead of a hard disk. > I'd try the SSD before I went to the pain of switching OS. People vary as to what they consider a "pain" regarding an OS. Much has to do with familiarity, both of the OS and the tools you have on it. I use both Windows and Linux, and have no doubts to which I find most efficient for development work. But I fully appreciate that others have different preferences, experiences and requirements. As for switching to an SSD, that will require less change in habits or tools, but it is not always an easy job with an existing system. If you are using Linux, I wouldn't bother with the SSD if your machine has plenty of ram (and upgrading ram is usually easy), but it makes a bigger difference on Windows. > (I still haven't found a Linux IDE as good as visual studio) I've never been an MSVS fan - again, it's subjective. But I believe MS Visual Studio Code has a good reputation on Linux. |
"Öö Tiib" <ootiib@hot.ee>: Dec 05 01:20PM -0800 On Thursday, 5 December 2019 22:37:20 UTC+2, Taylor wrote: > > location of image before change needs to be serialized for to be capable > > of restoring it. > Sure, I could serialize diffs, but with significant additional complexity (it's a bit close to the memento pattern). What diffs? Chain of reversible operations. First operation: Erase: that picture from there. Next operation Undo: put that picture back there. Next operation Redo: erase that picture again from there. What have diffs to do with Memento pattern? Utter nonsense. Read at least Wikipedia article about it. If you know of a way that flatbuffers makes that easier, that would be good to know. I couldn't find anything searching around. Flatbuffers? Huh? But it generates all code for you? All for needed for storing your data into buffer or reading it back from it. Bit verbose interface for my taste but clear enough. Have you at least tried the tutorials of it or something? Very confusing. |
Taylor <wtholliday@gmail.com>: Dec 05 01:42PM -0800 On Thursday, December 5, 2019 at 1:20:11 PM UTC-8, Öö Tiib wrote: > Next operation Redo: erase that picture again from there. > What have diffs to do with Memento pattern? Utter nonsense. > Read at least Wikipedia article about it. The chain of reversible operations (changes) you describe is error prone and requires additional complexity. As an example, in Photoshop, Adobe has abandoned the chain reversible operations in favor of value oriented design. I'd recommend watching Sean Parent's talks such as this one: https://www.youtube.com/watch?v=QGcVXgEVMJg. > it. Bit verbose interface for my taste but clear enough. Have you > at least tried the tutorials of it or something? > Very confusing. I've used flatbuffers extensively at this point. |
Vir Campestris <vir.campestris@invalid.invalid>: Dec 05 03:15PM On 05/12/2019 01:33, Ben Bacarisse wrote: >> The one that really strained C was the one where incrementing a >> pointer by 1 went to the next bit. Not byte or word. (TI GPU) > What problems does C have on a bit-addressed machine? Code that assumes you can copy a pointer into a number, then manipulate it. Lots of people do it, even though they shouldn't. sizeof is interesting when things don't have to be whole numbers of bytes. (you have a greyscale graphics plane with 3 bits per pixel, 800x600. How much RAM is that? On this thing it was literally 3 _bits_ x800x600, when most machines would end up unpacking the pixels into bytes.) But it's a long time ago. I don't recall all the details. Andy |
Ben Bacarisse <ben.usenet@bsb.me.uk>: Dec 05 03:31PM >> What problems does C have on a bit-addressed machine? > Code that assumes you can copy a pointer into a number, then > manipulate it. Lots of people do it, even though they shouldn't. That also should work on a bit-addressed machine. You mean, I think, that the code assumes some very specific things about the manipulation, most probably that (int)(p + 1) == (int)p + sizeof *p. <cut> -- Ben. |
Robert Wessel <robertwessel2@yahoo.com>: Dec 05 09:32AM -0600 On Wed, 04 Dec 2019 08:28:23 -0800, Keith Thompson <kst-u@mib.org> wrote: >or wider. The size in bits is a multiple of CHAR_BIT, which is at >least 8. An implementation could have 33-bit long int; on such a >system characters would have to be either 11 or 33 bits. To be pedantic, aren't longs allowed to have pad bits? Thus you could have a 33-bit long stored in five 8-bit characters. |
Keith Thompson <kst-u@mib.org>: Dec 05 10:03AM -0800 > On Wed, 04 Dec 2019 08:28:23 -0800, Keith Thompson <kst-u@mib.org> > wrote: [...] >>system characters would have to be either 11 or 33 bits. > To be pedantic, aren't longs allowed to have pad bits? Thus you could > have a 33-bit long stored in five 8-bit characters. Yes, C++ permits padding bits (bits that do not contribute to the value). You're suggesting a long type with a *size* of 5 bytes / 40 bits and a *width* of 33 bits, which is permitted. (The width includes the sign bit.) When I wrote "33-bit long int", I meant CHAR_BIT * sizeof (long int) == 33 I could have made that clearer. -- Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst> Working, but not speaking, for Philips Healthcare void Void(void) { Void(); } /* The recursive call of the void */ |
Manfred <noname@add.invalid>: Dec 05 05:29PM +0100 On 12/5/2019 3:58 AM, alexo wrote: > No, Manfred > That gives the runtime error again. Both the move compy constructor and > the move assignment operator should take non const reference. Yes, that's what I wrote in my second message. > { > if(data) > delete [] data; here sz should be set as well (as in my first post, where s.sz was another typo, though) |
JiiPee <no@notvalid.com>: Dec 05 02:21PM On 05/12/2019 01:57, Bo Persson wrote: > would match the template doesn't help, as type deduction is performed > first and enumVal1 just isn't a T. So that template is not added to > the potential overload set. ok, thanks. A little difficult to google these issues, thats why asked here :) |
Sam <sam@email-scan.com>: Nov 27 06:40PM -0500 Daniel writes: > Is it reasonable that vs2019 produces a warning > warning C4127: conditional expression is constant > consider using 'if constexpr' statement instead The compiler does not reject this code as ill-formed; and only issues a non- fatal diagnostic. This is entirely the compiler's prerogative. Whether this or something else is "reasonable" is often a somewhat subjective matter. Someone might find it reasonable, this is a suggested optimization. Someone else may find this to be annoying. It is quite common to have constant expressions when doing template meta-programming, so the compiler's going to bark at you, now? That only servers as a discouragement from turning on the "treat all warning as fatal" prophylactic measures. That's the camp I'm in. |
David Brown <david.brown@hesbynett.no>: Nov 29 09:23AM +0100 On 28/11/2019 21:04, Robert Wessel wrote: > On Thu, 28 Nov 2019 11:58:40 +0100, Bo Persson <bo@bo-persson.se> > wrote: <snip> >> Don't know exactly which one makes the difference. :-) > Almost certainly /W4 instead of /Wall. The latter is pretty unusable. I am unlikely to remember all the switches given by Bo (though I will remember that any oddities I see in MSVC may be alleviated by switches). But I will definitely try to remember /W4 instead of /Wall. I guess MSVC takes "/Wall" more literally than gcc "-Wall". |
boltar@nowhere.co.uk: Dec 05 12:51PM On Wed, 4 Dec 2019 18:36:05 +0000 >>> You just contradicted yourself, dear. >> No, its my accurate opinion that no one else gives a damn. >That is not just speaking for yourself, dear. Never mind. Btw, you need to work on your patronisation skills. |
boltar@nowhere.co.uk: Dec 05 12:51PM On Wed, 4 Dec 2019 18:34:41 +0000 >> chute as Roguewaves APIs did back in the 00s the better. There's been little >> good reason to use it since c++14 came out. >That's because a good deal of boost is now part of C++; if boost was rubbish A good deal? Maybe 10%. >that wouldn't have happened, idiot. The average landfill has a few jems in it. |
Tim Rentsch <tr.17687@z991.linuxsc.com>: Nov 28 03:44PM -0800 > as the type of a complete object and when it is used as the type of > a subobject. > ... No it cannot. Refer to n4659, section 6.11, paragraph 1. Note in particular the last sentence, which says in part (with my emphasis added): An object type imposes an alignment requirement on EVERY OBJECT of that type There is no provision for the alignment varying according to whether the object is a complete object or a subobject. |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Nov 29 12:14AM +0100 On 28.11.2019 21:19, Tim Rentsch wrote: >> teams that manage to hire members with godly hands macros are >> fine. :D > [snip] here, the shortcomings [of macros] don't apply? They do. For example, regarding what was mentioned about scope, you generally can't have two libraries that both define `ONESCOMPLEMENT`. Perhaps library A defines it as above but library B defines it to produce a one's complement. Perhaps both define it as above but using library B you get a redefinition warning. And for example, regarding the so far not mentioned visual impact, the shouting uppercase is an annoying eyesore. - 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