Prev: Problem handling keyboard events in ActiveX on IE8
Next: project dependencies: satellite dlls and main-project
From: Cameron_C on 22 Jun 2010 13:33 Is there any performance differences among the rainbow of choices? Or all about the same? I am guessing that the Feature Pack implementation would be the best choice of direction overall, since it is incorporated into the MFC framework? "Pete Delgado" wrote: > > "Giovanni Dicanio" <giovanniDOTdicanio(a)REMOVEMEgmail.com> wrote in message > news:%23IDkFfiELHA.5736(a)TK2MSFTNGP02.phx.gbl... > > On 22/06/2010 17:56, Cameron_C wrote: > > > >> I have read about references to a "boost" library, and I have read > >> references to an ATL regex class, and I have read something about Regular > >> Expressions being included in SP1 of VS2008. > > > > The ATL regular expression class is CAtlRegEx, and it was available in VC8 > > (i.e. VS2005), too: > > > > http://msdn.microsoft.com/en-us/library/k3zs4axe(VS.80).aspx > > > > I don't know about boost's regex, but it is correct that with the C++ > > Feature Pack (and then SP1) for VS2008 a regular expression template well > > integrated with STL was offered (this is available in VS2010 as well): > > > > http://msdn.microsoft.com/en-us/library/bb982727.aspx > > http://msdn.microsoft.com/en-us/library/bb982382.aspx > > > > > > If you plan to write portable C++ code you may want to consider the TR1's > > regex engine. If you don't like STL style and are not interested in > > multiplatform C++ code, you may consider the CAtlRegEx class instead. > > The boost library implementation is as portable as the stl version... > > > > > Note that TR1's regex engine uses C++ exceptions (e.g. regex_error class > > is thrown in some cases), instead ATL's CAtlRegEx tends to use error > > return codes (like BOOLeans). So if your programming style tends to prefer > > error codes instead of exceptions you may want to choose CAtlRegEx. > > CAtlRegEx uses a limited, non-standard syntax while both boost and the TR1 > regular expression libraries support a variety of standard regular > expression syntaxes. Personally, I don't think I will ever use the ATL > regular expression library again because of its limitations. > > -Pete > > > . >
From: Pete Delgado on 22 Jun 2010 15:59 "Cameron_C" <CameronC(a)discussions.microsoft.com> wrote in message news:1C7F2250-657A-429E-8306-7455F08BEFD4(a)microsoft.com... > > Is there any performance differences among the rainbow of choices? > Or all about the same? > I am guessing that the Feature Pack implementation would be the best > choice > of direction overall, since it is incorporated into the MFC framework? > I've never run a performance test on any of the packages since for my needs, any of the packages would have been "fast enough". Unless you are doing some heavy text processing as the primary function of your application, it will likely be the same for you! The "feature pack" implementation was not a part of MFC but rather is an implementation of the C++ TR1 addition to the ISO 2003 C++ standard. The two were simply delivered together. Why not take a look at all three libraries and see which one you find to be easiest in both syntax and usage? The library that you are comfortable using is perhaps the best choice with all else being equal! -Pete
From: Joseph M. Newcomer on 22 Jun 2010 17:13 See below... On Tue, 22 Jun 2010 12:26:45 -0400, "Pete Delgado" <Peter.Delgado(a)NoSpam.com> wrote: > >"Cameron_C" <CameronC(a)discussions.microsoft.com> wrote in message >news:54293FD0-0333-40D0-92D8-E2B62A03C822(a)microsoft.com... >> Hello again folks, >> I am working through things in my application, and I would appreciate any >> recommended approaches to using Regular Expressions in my code. >> This is an MFC application. I am using Visual Studio 2008 pro. >> I have read about references to a "boost" library, and I have read >> references to an ATL regex class, and I have read something about Regular >> Expressions being included in SP1 of VS2008. >> I wnat to use regular expressions to edit telephone numbers, and Postal >> Codes, and dollar amount fields. >> >> Anyway, if anyone has any experience with any of the above, and can offer >> some advice or recommendation, I would appreciate it. >> > >Any of the above approaches that you have mentioned will work, however as >with any engineering decision, there are tradeoffs. I would recommend >against using the ATL regular expression library because it uses a >non-standard syntax **** With decades of regular expression tradition, it continues to amaze me that someone could be STUPID enough to invent a nonstandard syntax and think it could possibly make sense. I do not use the library for the same reason! **** >and is fairly limited in its abilities.If you can handle >the limitations of the library and are willing to work with the peculiar >regular expression syntax for the library, it will probably work as well. > >I personally prefer to use the std::tr1 regular expression library, but I >have used the boost regular expression library as well. A quick look on the >net shows more examples of usage for the boost libraries than for the tr1 >libraries so this may be a determening factor for you! **** There are several variants of the FreeBSD regular expression library out there, as well; I don't know if boost uses one of them. But I have my own adaptation of the FreeBSD library and I use it, because it uses the historically established regex syntax that everyone already knows. joe **** > >-Pete > >TR1 >http://www.johndcook.com/cpp_regex.html >http://msdn.microsoft.com/en-us/library/bb982727.aspx > > >Boost >http://www.boost.org/doc/libs/1_43_0/libs/regex/doc/html/index.html >http://onlamp.com/pub/a/onlamp/2006/04/06/boostregex.html > Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Joseph M. Newcomer on 22 Jun 2010 17:16 See below... On Tue, 22 Jun 2010 10:33:28 -0700, Cameron_C <CameronC(a)discussions.microsoft.com> wrote: > >Is there any performance differences among the rainbow of choices? **** Why do you think it matters? How many millions of matches are you going to need to make for each regexp? (Note: if you cannot express it in terms of integer multiples of millions, the performance probably won't matter) **** >Or all about the same? >I am guessing that the Feature Pack implementation would be the best choice >of direction overall, since it is incorporated into the MFC framework? **** Avoid anything nonstandard. So the TR1 design (which probably involved intelligent, thinking human beings) should be a reasonable choice. joe **** > >"Pete Delgado" wrote: > >> >> "Giovanni Dicanio" <giovanniDOTdicanio(a)REMOVEMEgmail.com> wrote in message >> news:%23IDkFfiELHA.5736(a)TK2MSFTNGP02.phx.gbl... >> > On 22/06/2010 17:56, Cameron_C wrote: >> > >> >> I have read about references to a "boost" library, and I have read >> >> references to an ATL regex class, and I have read something about Regular >> >> Expressions being included in SP1 of VS2008. >> > >> > The ATL regular expression class is CAtlRegEx, and it was available in VC8 >> > (i.e. VS2005), too: >> > >> > http://msdn.microsoft.com/en-us/library/k3zs4axe(VS.80).aspx >> > >> > I don't know about boost's regex, but it is correct that with the C++ >> > Feature Pack (and then SP1) for VS2008 a regular expression template well >> > integrated with STL was offered (this is available in VS2010 as well): >> > >> > http://msdn.microsoft.com/en-us/library/bb982727.aspx >> > http://msdn.microsoft.com/en-us/library/bb982382.aspx >> > >> > >> > If you plan to write portable C++ code you may want to consider the TR1's >> > regex engine. If you don't like STL style and are not interested in >> > multiplatform C++ code, you may consider the CAtlRegEx class instead. >> >> The boost library implementation is as portable as the stl version... >> >> > >> > Note that TR1's regex engine uses C++ exceptions (e.g. regex_error class >> > is thrown in some cases), instead ATL's CAtlRegEx tends to use error >> > return codes (like BOOLeans). So if your programming style tends to prefer >> > error codes instead of exceptions you may want to choose CAtlRegEx. >> >> CAtlRegEx uses a limited, non-standard syntax while both boost and the TR1 >> regular expression libraries support a variety of standard regular >> expression syntaxes. Personally, I don't think I will ever use the ATL >> regular expression library again because of its limitations. >> >> -Pete >> >> >> . >> Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Giovanni Dicanio on 22 Jun 2010 17:44 On 22/06/2010 23:16, Joseph M. Newcomer wrote: > Avoid anything nonstandard. So the TR1 design (which probably involved intelligent, > thinking human beings) should be a reasonable choice. IMHO, if the OP doesn't have exception-safe code, he may consider the ATL engine, which uses error codes instead of C++ exceptions to signal error condition (the TR1 engine uses exceptions instead and is highly integrated with STL). I think it's not what is best or worst in absolute, but what is best or worst in the given context of existing OP's code. I agree with Joe about the performance stuff (probably, considering that the ATL engine is more lightweight than the TR1, it could be more efficient... but as already noted, does it really make a difference in working code? How many matches/second are requested?? :) Giovanni
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: Problem handling keyboard events in ActiveX on IE8 Next: project dependencies: satellite dlls and main-project |