- named capchering groups (regex) - 8 Updates
- SDL removed from neoGFX - 1 Update
- Class declaration - 10 Updates
- "C++ proposal dismisses backward compatibility" - 2 Updates
- Ridiculously high standards? - 2 Updates
RM <robert_magdziarz@wp.pl>: Apr 08 04:57PM +0200 Are there is C++'s regexes named capchering groups and can I use them with sub_match object? I have a problem with translating from PHP to C++ some code that uses PHP's preg_match_all function. |
Melzzzzz <Melzzzzz@zzzzz.com>: Apr 08 03:11PM > Are there is C++'s regexes named capchering groups and can I use them > with sub_match object? I have a problem with translating from PHP to C++ > some code that uses PHP's preg_match_all function. I haven't use C++ regex, because I used regex much earlier then they are introduced. What I would do I would simply find reference documentation on internet. -- press any key to continue or any other to quit... U ničemu ja ne uživam kao u svom statusu INVALIDA -- Zli Zec Svi smo svedoci - oko 3 godine intenzivne propagande je dovoljno da jedan narod poludi -- Zli Zec Na divljem zapadu i nije bilo tako puno nasilja, upravo zato jer su svi bili naoruzani. -- Mladen Gogala |
James Kuyper <jameskuyper@alumni.caltech.edu>: Apr 08 11:46AM -0400 On 4/8/20 10:57 AM, RM wrote: > Are there is C++'s regexes named capchering groups and can I use them > with sub_match object? I have a problem with translating from PHP to C++ > some code that uses PHP's preg_match_all function. Melzzzzz has already given you the main advice I would have given you. I'll just point out that you'll find what you're looking for more easily if you spell it "capturing". |
Christian Gollwitzer <auriocus@gmx.de>: Apr 08 05:49PM +0200 Am 08.04.20 um 16:57 schrieb RM: > Are there is C++'s regexes named capchering groups and can I use them > with sub_match object? I have a problem with translating from PHP to C++ > some code that uses PHP's preg_match_all function. PHP uses the PCRE library in order to handle regexps. So if you also link to PCRE, the expressions will be compatible. If this named capturing is the only problem, then you might get away without these names. Just delete the names in the regexps and manually count the groups. After all, named capturing does not add any functionality, it is just a convenience for programmers such that it is easier to refer to the subgroup, but you can always do so by the number of the group. Christian |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Apr 08 06:45PM +0200 On 08.04.2020 16:57, RM wrote: > Are there is C++'s regexes named capchering groups and can I use them > with sub_match object? I have a problem with translating from PHP to C++ > some code that uses PHP's preg_match_all function. Just note that the still young regex sub-library is scheduled for deprecation, if it isn't deprecated already in C++17, because it just doesn't know how to deal with UTF-8. I think that's weird since the default syntax is Javascript's (IIRC). But. - Alf |
Jorgen Grahn <grahn+nntp@snipabacken.se>: Apr 08 07:17PM On Wed, 2020-04-08, Alf P. Steinbach wrote: > Just note that the still young regex sub-library is scheduled for > deprecation, if it isn't deprecated already in C++17, because it just > doesn't know how to deal with UTF-8. Any reference for this? cppreference.com doesn't mention this; instead the regex library seems to have grown somewhat in C++17. /Jorgen -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o . |
"Öö Tiib" <ootiib@hot.ee>: Apr 08 01:57PM -0700 On Wednesday, 8 April 2020 22:17:48 UTC+3, Jorgen Grahn wrote: > > doesn't know how to deal with UTF-8. > Any reference for this? cppreference.com doesn't mention this; instead > the regex library seems to have grown somewhat in C++17. Perhaps it is for to make C++ regex to differ from PCRE. For me such things always weaken, add controversy to and confusion with everything that is involved. |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Apr 09 12:06AM +0200 On 08.04.2020 21:17, Jorgen Grahn wrote: >> doesn't know how to deal with UTF-8. > Any reference for this? cppreference.com doesn't mention this; instead > the regex library seems to have grown somewhat in C++17. Not sure exactly where I picked that up but Mr. Google now found a February 15. 2020 comment by Tom Honermann, "In Prague, during the SG16 discussion of P1844R1 - Enhancement of regex, we had consensus to move forward with a proposal to deprecate std::regex due to performance and ABI concerns." https://github.com/sg16-unicode/sg16/issues/57 There's no more than that and a link to the enhancement paper, but one possible problem may be that e.g. regex-searching for three consecutive non-space characters can find a single UTF-8 char, if the regex engine is specified as or implemented as simple byte sequence searching. Since non-ASCII UTF-8 chars consist entirely of bytes >= 128 and start with special pattern I don't think erroneously finding things /within/ UTF-8 characters is a problem. But until such time as C++ support for all kinds of character encodings is removed there could be that problem with other encodings, e.g. in particular my association circuit now pops up Shift-JIS. So maybe they have considered also that, but it would be nice with some feature where you can say, "Hey, support only UTF-8!". 😃 - Alf |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Apr 08 09:51PM +0100 Hi! SDL is no longer a neoGFX dependency! That is all. /Flibble -- "Snakes didn't evolve, instead talking snakes with legs changed into snakes." - Rick C. Hodgin "You won't burn in hell. But be nice anyway." – Ricky Gervais "I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Byrne 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." |
"koloss88@hotmail.com" <koloss88@hotmail.com>: Apr 08 01:57AM -0700 Hi, i need to solve the following problem: (All Code is Pseudo-Code) I want to define a list of Persons. virtual class Person { Person(char* name, char* vorname, date birthday); char* name; char* vorname* date birthday; static int counter; Person* Father; Person* Mother; } Now i want to tell between Man an Women class Man : Public Person { Man() : Person(char*, char*, date); bool prop1; short prop2; short prop3; // List an event has to be added to(Man-Specific) //right place here? } class Woman : public Person { Woman(char*, char*, date) : Person(char*, char*, date); bool prop1; short prop2; short prop3; // List an events has to be added to (Woman-Specific) //right place here? } So far, so good. Now there is an event that has to go in a List: add_Event(Person* Person2, place, date); The question is, where to put that Method? - in a method in Person? - in a method in another class (SLIST)? - as a friend-function of both Man/Woman That Event could be anything from "going out", "Have Diner", "Go Shopping", etc. But I have to tell between Man and Woman. Example: Person* Mary = new Person(Smith, Mary, 01.01.1980); Person* Gordon = new Person(Brown, Gordon, 12.03.1975); Mary->add_Event(Gordon, Cinema, today(20:00)); Now add_Event has to do the following(SIMPLE): - if Mary->prop1 == 0 then prop1 = 1 - SLIST->add_event Mary(Gordon, Cinema, today(20:00)) - SLIST->add_event Godon(Mary, Cinema, today(20:00)) I hope this is clear... Any help would be nice *** win10, IntelQuadCore(), 8GB |
Ned Latham <nedlatham@woden.valhalla.oz>: Apr 08 04:26AM -0500 > short prop3; > // List an event has to be added to(Man-Specific) //right place here? > } Why not class Person { Person(char* name, char* vorname, date birthday); char* name; char* vorname* date birthday; bool sex; bool prop1; short prop2; short prop3; static int counter; Person* Father; Person* Mother; } and put the method(s) in there? |
"koloss88@hotmail.com" <koloss88@hotmail.com>: Apr 08 02:48AM -0700 Am Mittwoch, 8. April 2020 11:27:07 UTC+2 schrieb Ned Latham: > > *** > > win10, IntelQuadCore(), 8GB Hi, the properties of Man and Woman are not the same. They are Gender_Specific. But a good Idea... |
Ned Latham <nedlatham@woden.valhalla.oz>: Apr 08 05:00AM -0500 koloss88 wrote: > Hi, > the properties of Man and Woman are not the same. They are Gender_Specific. > But a good Idea... The bool "sex" could be used to differentiate a variant record. Actually, I'd prefer a different approach, perhaps through a typedef: typedef enum { man, woman } sex; |
"koloss88@hotmail.com" <koloss88@hotmail.com>: Apr 08 03:06AM -0700 Am Mittwoch, 8. April 2020 12:00:17 UTC+2 schrieb Ned Latham: > The bool "sex" could be used to differentiate a variant record. > Actually, I'd prefer a different approach, perhaps through a typedef: > typedef enum { man, woman } sex; Hi, i do think about it. Thanks for your help. |
Paavo Helde <eesnimi@osa.pri.ee>: Apr 08 01:17PM +0300 > Person* Father; > Person* Mother; > } There is no need to use char* for strings in C++, use std::string instead. > So far, so good. Now there is an event that has to go in a List: > add_Event(Person* Person2, place, date); > The question is, where to put that Method? Much more important is where you hold the data about the event. If directly inside Person, then you have to duplicate and synchronize it everywhere (imagine a football match event with 10,000 persons attending). I would make a separate Event class, containing description, date and time, etc. Then I would add a Participate member function in Person: class Event { // ... }; class Person { // ... std::deque<std::shared_ptr<Event>> events_; public: void Participate(std::shared_ptr<Event> event) { events_.push_back(event); } }; Usage example: Person Mary("Smith", "Mary", "01.01.1980"); Person Gordon("Brown", "Gordon", "12.03.1975"); auto event1 = std::make_shared<Event>("Cinema", "today(20:00)"); Mary.Participate(event1); Gordon.Participate(event1); Many other ways to build up such a program are possible, the choice depends primarily on what tasks the program has to carry out. > - in a method in Person? > - in a method in another class (SLIST)? > - as a friend-function of both Man/Woman Avoid friend functions as much as possible. |
"koloss88@hotmail.com" <koloss88@hotmail.com>: Apr 08 07:03AM -0700 > Any help would be nice > *** > win10, IntelQuadCore(), 8GB Hi, no offense, but I prefer the Paavo-Solution. That is, what I was looking for. Thanks alot. M. |
Jorgen Grahn <grahn+nntp@snipabacken.se>: Apr 08 02:35PM On Wed, 2020-04-08, Paavo Helde wrote: >> static int counter; >> Person* Father; >> Person* Mother; When there are "soft" chains like that, I tend to invent a unique ID and look up parents and grandparents by ID. Kind of like a database. Watch out for loops! ... >> Now i want to tell between Man an Women >> class Man : Public Person ... >> class Woman : public Person What an odd thing to split on! How about people who are dead, anonymous, non-binary or babies? ... > Many other ways to build up such a program are possible, the choice > depends primarily on what tasks the program has to carry out. Exactly. The original class design looked wrong to me, but there's no way to tell what a good design is without knowing that task. There's no single Person class that fits all purposes. (And here I have to admit I didn't read the part about Events. It reminded me about genealogical data, but my thinking stopped there.) /Jorgen -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o . |
Melzzzzz <Melzzzzz@zzzzz.com>: Apr 08 03:10PM > When there are "soft" chains like that, I tend to invent a unique ID > and look up parents and grandparents by ID. Kind of like a database. > Watch out for loops! Pointer is unique ID. I think Oracle supports pointers, so that one does not have to invent ID's... -- press any key to continue or any other to quit... U ničemu ja ne uživam kao u svom statusu INVALIDA -- Zli Zec Svi smo svedoci - oko 3 godine intenzivne propagande je dovoljno da jedan narod poludi -- Zli Zec Na divljem zapadu i nije bilo tako puno nasilja, upravo zato jer su svi bili naoruzani. -- Mladen Gogala |
Jorgen Grahn <grahn+nntp@snipabacken.se>: Apr 08 07:36PM On Wed, 2020-04-08, Melzzzzz wrote: >> and look up parents and grandparents by ID. Kind of like a database. >> Watch out for loops! > Pointer is unique ID. Are you're advocating code like the above, or are you (which would be fair enough) nitpicking? > I think Oracle supports pointers, so that one does not have to > invent ID's... I didn't suggest that the OP should use a database, from Oracle or another vendor; I'm not very familiar with them. /Jorgen -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o . |
jacobnavia <jacob@jacob.remcomp.fr>: Apr 08 06:10PM +0200 Le 06/04/2020 à 19:41, Lynn McGuire a écrit : > "Proposal to the C++ standards committee would give up backward and > binary compatibility for safety and simplicity" > Lynn I quote from the document <quote> Titus Winters writes in "Non-Atomic Refactoring and Software Sustainability": What is the difference between programming and software engineering? These are nebulous concepts and thus there are many possible answers, but my favorite definition is this: Software engineering is programming integrated over time. All of the hard parts of engineering come from dealing with time: compatibility over time, dealing with changes to underlying infrastructure and dependencies, and working with legacy code or data. Fundamentally, it is a different task to produce a programming solution to a problem (that solves the current [instance] of the problem) vs. an engineering solution (that solves current instances, future instances that we can predict, and - through flexibility - allows updates to solve future instances we may not be able to predict). From this definition of "software engineering" vs. "programming" we suggest that C++ should prioritize being more of a "software engineering" language, and less of a "programming" language. We specifically are interested in dealing with the time-oriented aspects of software built in this language. <end quote> OK, C++ should deal with maintaining software over time. Great. But THAT IMPLIES BACKWARDS COMPABILITY!!! You CAN'T have stable software if the underlying language forces a rewrite evrey year or so, even if it is a minimal rewrite. For instance GTK and the Windows API. I have written an IDE in C using the windows API with windows 95, i.e. 25 years ago. Most of the logic has survived UNCHANGED from windows 95 to windows 10. And that is one of the best features of that API. You write your software and with minor changes it will go on running for MANY years. I ported my IDE to GTK 2, and after 6 months of work it was running. Then, I discovered that I should rewrite it because GTK had changed all the API in many incompatible ways. That was the end of it. I never used GTK again. Today, the GNOME people are changing everything each 6 months or so, as they explicitely said. Nobody is following and you just can't write any software for Linux GUI unless you use some propietary language where somebody else does the job of porting a stable API to the new GTK+ version each 6 months. Nobody will follow, nobody will rewrite their software again and again. |
Melzzzzz <Melzzzzz@zzzzz.com>: Apr 08 05:26PM > Nobody will follow, nobody will rewrite their software again and again. +1. I programmed in Rust before 1.0, what a nightmare. Now that goes for libraries. You don't know what is worse? If library api changes or language changes. What a wasted time. -- press any key to continue or any other to quit... U ničemu ja ne uživam kao u svom statusu INVALIDA -- Zli Zec Svi smo svedoci - oko 3 godine intenzivne propagande je dovoljno da jedan narod poludi -- Zli Zec Na divljem zapadu i nije bilo tako puno nasilja, upravo zato jer su svi bili naoruzani. -- Mladen Gogala |
woodbrian77@gmail.com: Apr 07 07:41PM -0700 Shalom Can you give me some suggestions on how to improve this: https://github.com/Ebenezer-group/onwards Thanks in advance. Brian Ebenezer Enterprises http://webEbenezer.net |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Apr 08 06:41PM +0200 > Can you give me some suggestions on how to > improve this: > https://github.com/Ebenezer-group/onwards You can start by renaming the "Readme" file to "README.md", then Github will display it as markdown. That means you can use e.g. *emphasis*, headings, tables etc. You will probably have to rewrite "*nix" as "\*nix" (it then presents as "*nix"). https://guides.github.com/features/mastering-markdown/ One nice advantage of markdown is that you can include images, such as a graphic showing the data flow (or whatever's relevant) of your tools. I use the Visual Code editor to edit Github markdown. It has a nice dynamic result preview on the side. --- "The C++ Middleware Writer (CMW) is an on-line code generator." Well that could be anything. Assuming that it's about what I think it's about I'd include mention of RPC in general and CORBA and Java RMI (possibly also DCOM) as concrete examples. If your code generator addresses a higher abstraction level then maybe also mention of MQ systems. https://en.wikipedia.org/wiki/Remote_procedure_call https://en.wikipedia.org/wiki/Common_Object_Request_Broker_Architecture https://en.wikipedia.org/wiki/Java_remote_method_invocation https://en.wikipedia.org/wiki/Distributed_Component_Object_Model https://en.wikipedia.org/wiki/Message_queue --- Three things I noticed reading the "Readme": * The need to run a component on a *nix system. Huh. * The need for an account number in invocations. Huh. * No link to example. That's easy with markdown. ;-) - 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