comp.lang.c++@googlegroups.com | Google Groups | ![]() |
Unsure why you received this message? You previously subscribed to digests from this group, but we haven't been sending them for a while. We fixed that, but if you don't want to get these messages, send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
- Free tickets to hack.summit() - A Virtual Programming Conference for Charity Featuring the World's Top Programmers - 2 Updates
- or vs || , and a template question - 14 Updates
- Anyone using a C++ ORM like Hibernate for Java? - 3 Updates
- Any tools for "refactoring" C++ code? - 3 Updates
- Scott Meyers' new book available (as download) now - 2 Updates
- Free C/C++ static code analyzer CppCat for Students - 1 Update
surabhi@triplepointpr.com: Nov 18 12:08PM -0800 Hi everyone, Just wanted to let you know about a special opportunity for subscribers to this group. We're hosting a virtual conference called hack.summit() taking place December 1-4, where you can learn from some of the best programmers in the world. An unprecedented line-up of programmers including creators of Ruby on Rails, CSS, Google Glass, the Java language spec, Agile, Extreme Programming, Test Driven Development, Heroku, Spark, Bittorrent, UML, the Wiki, and many more will be speaking and answering audience questions,. ALL proceeds go to support coding non-profits, such as ones that help drive inclusivity and diversity in the coding space. If you're interested in attending, check out the website and Facebook page for more info. I'm happy to offer you free passes to bypass the registration process--just visit hacksummit.org and register using the code REGISTERFREE. Over 12,000 developers registered in the first few days -- if this continues, then this will be one of the largest developer events ever held. You're not going to want to miss it. Hope to see you at the summit, and thanks for your time :) hacksummit.org https://www.facebook.com/hack.summit @hack_summit |
legalize+jeeves@mail.xmission.com (Richard): Nov 18 09:02PM [Please do not mail me a copy of your followup] surabhi@triplepointpr.com spake the secret code >Extreme Programming, Test Driven Development, Heroku, Spark, Bittorrent, If you're interested in Test-Driven Development for C++, try my workshop from C++ Now! 2014: <https://github.com/boostcon/cppnow_presentations_2014/tree/master/files/test_driven> -- "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline> The Computer Graphics Museum <http://computergraphicsmuseum.org> The Terminals Wiki <http://terminals.classiccmp.org> Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com> |
JiiPee <no@notvalid.com>: Nov 18 06:58PM Is this forum also a place to ask simple questions? Sometimes does not find answer for something. Anyway here two: 1) New C++ has keywords "or" to replace ||. LIke: int a = 6; if(a == 5 or a > 9) .... (old: if(a == 5 || a > 9) ) I really like "or" because its more readable. But is there something against using it? Why C++ people normally still prefer ||, I don't see people using "or" ? Is there a reason for it? I like to use all the improvements as they come with C++ ... 2) I found a piece of code: template <typename T, size_t N> void foo( T(&arr)[N] ) { // use arr - array... } and called: int arr[] = {1,2,3}; foo(arr); Been scratching my head with this... I am not familiar with this syntax T(&arr)[N]. What is that? Why it takes arr's address (&arr)? Or is it a reference? Also, is this a template function argument which can automatically find T and N from array arr when called? Would like to know that this T(&arr)[N] means. I know N is the size of the array, but the rest... thanks |
red floyd <no.spam@its.invalid>: Nov 18 11:11AM -0800 On 11/18/2014 10:58 AM, JiiPee wrote: > array arr when called? > Would like to know that this T(&arr)[N] means. I know N is the size > of the array, but the rest... It's a reference to an array of N elements of type T. A common usage is template<typename T, size_t N> size_t array_size(T(&arr)[N]) { return N; } |
JiiPee <no@notvalid.com>: Nov 18 07:31PM On 18/11/2014 19:21, Martin Shobe wrote: > is the type of object in the array. Yes, the template function is > automatically found when the call to foo is compiled. > Martin Shobe ok thanks |
JiiPee <no@notvalid.com>: Nov 18 07:35PM template <typename T, size_t N> void foo( T(&arr)[N] ) { // use arr - array... } and called: int arr[] = {1,2,3}; foo(arr); On 18/11/2014 19:21, Martin Shobe wrote: > Yes, the template function is automatically found when the call to > foo is compiled. I meant the foo function is able to automatically know T and N from the call foo(arr); So obviously arr carries with it the information of its size and its elements type I guess. Thats how foo know them. |
JiiPee <no@notvalid.com>: Nov 18 07:38PM On 18/11/2014 19:11, red floyd wrote: > { > return N; > } oh cool , this was new to me. The way to get the size of an array. |
JiiPee <no@notvalid.com>: Nov 18 07:46PM On 18/11/2014 19:21, Martin Shobe wrote: > Other than that, I continue to use || because it's what I expect to > see when reading C++. Ok, but do you agree that: if( a == 5 or a == 8 ) is more human readable than if( a == 5 || a == 8 ) ? we are really doing or-operation there, so how could something else than or be better? |
scott@slp53.sl.home (Scott Lurndal): Nov 18 08:08PM >if( a == 5 or a == 8 ) >is more human readable than >if( a == 5 || a == 8 ) Having two ways to do the same thing in a single language wasn't a good idea. In fact, this 'or' in C++ is a spectacularly bad idea. Many of us don't have the option of using a newer compiler, or must use many different versions of compilers (for various reasons) and for that reason alone cannot (and will not) use 'or' in place of the conditional-OR operator. |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Nov 18 12:10PM -0800 On Tuesday, November 18, 2014 2:47:00 PM UTC-5, JiiPee wrote: > if( a == 5 or a == 8 ) > is more human readable than: > if( a == 5 || a == 8 ) I would say for most C/C++ developers, reading || and && are so second nature now that it's not any easier to read. But for newcomers to the language, and in moving forward, having the or,and make sense. I think there should also be xor, not, neg. Best regards, Rick C. Hodgin |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Nov 18 12:12PM -0800 On Tuesday, November 18, 2014 3:08:44 PM UTC-5, Scott Lurndal wrote: > use many different versions of compilers (for various reasons) and > for that reason alone cannot (and will not) use 'or' in place of the > conditional-OR operator. I'm not sure it's a good idea to maintain like unto the past because there are ways to do things in the present which are incompatible with the way things were done in the past. I think the goal should always be looking forward, not looking backward. Best regards, Rick C. Hodgin |
Wouter van Ooijen <wouter@voti.nl>: Nov 18 09:28PM +0100 Martin Shobe schreef op 18-Nov-14 9:08 PM: > only means or in English (okay maybe there are other languages). Someone > who speaks French might find using the word for gold rather odd. Symbols > don't usually carry such baggage. That hypotetical frenchman would have to get used to English anyway (if then else do operator class template namespace throw catch ...). Wouter van Ooijen (Dutch) |
JiiPee <no@notvalid.com>: Nov 18 08:44PM On 18/11/2014 20:12, Rick C. Hodgin wrote: > be looking forward, not looking backward. > Best regards, > Rick C. Hodgin I agree. When I make code nowadays, am not trying make it so that it would also compile with gnu 2.1 from 1995 :). But obviously some are forced to do that. I also agree that its not good to have two ways to do this thing. But "or" should have been the first choice even 1985 ... imo. |
JiiPee <no@notvalid.com>: Nov 18 08:46PM On 18/11/2014 20:08, Martin Shobe wrote: > Someone who speaks French might find using the word for gold rather > odd. Symbols don't usually carry such baggage. > Martin Shobe but they use "or" in other languages.. for example visual basic uses it... so it is a good candidate |
JiiPee <no@notvalid.com>: Nov 18 08:47PM On 18/11/2014 20:28, Wouter van Ooijen wrote: > (if then else do operator class template namespace throw catch ...). > Wouter van Ooijen > (Dutch) yes agree. Also there are many other keywords also which are in english, like for, do, ... almost all. So I do not see this argument being good in that way. |
JiiPee <no@notvalid.com>: Nov 18 08:50PM On 18/11/2014 20:10, Rick C. Hodgin wrote: > I think there should also be xor, not, neg. > Best regards, > Rick C. Hodgin "not" is there already :) |
Robert Hutchings <rm.hutchings@gmail.com>: Nov 18 12:52PM -0600 Since I will be accessing a MySQL database, I was wondering if there are any C++-specific object-relational mapping libraries out there? I Googled and found a couple, but I wondered if anyone here is using one? |
legalize+jeeves@mail.xmission.com (Richard): Nov 18 08:27PM [Please do not mail me a copy of your followup] Robert Hutchings <rm.hutchings@gmail.com> spake the secret code >Since I will be accessing a MySQL database, I was wondering if there are >any C++-specific object-relational mapping libraries out there? I >Googled and found a couple, but I wondered if anyone here is using one? I haven't actually used it, but the one that struck me as the one I'd like to use was odb: <http://www.codesynthesis.com/products/odb/> -- "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline> The Computer Graphics Museum <http://computergraphicsmuseum.org> The Terminals Wiki <http://terminals.classiccmp.org> Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com> |
Robert Hutchings <rm.hutchings@gmail.com>: Nov 18 02:33PM -0600 On 11/18/2014 2:27 PM, Richard wrote: >> Googled and found a couple, but I wondered if anyone here is using one? > I haven't actually used it, but the one that struck me as the one I'd > like to use was odb: <http://www.codesynthesis.com/products/odb/> That was the one I liked when I googled around.... |
"Öö Tiib" <ootiib@hot.ee>: Nov 17 04:01PM -0800 On Monday, 17 November 2014 23:34:40 UTC+2, Scott Lurndal wrote: > component (e.g. libstdc++.so.6 on linux) is dynamically linked, > most benefit would accrue sans recompilation by simply updating > the library to a newer version. How? Big part of C++ standard libraries is implemented in include files. C++ library can't be replaced without recompiling. > for most real-world projects; given internal dependencies, third-party > dependencies, the effort required to requalify any non-trivial > application with the new compilation tools and the cost of labor. I did not say that it is cost-free. I said that Vincenzo was correct that recompiling C++98 code with C++11 compiler does often improve product's performance. If serious maintenance works are in plan anyway then the switch is possibly worth it. Also most of the developers actually like to switch to more modern tools. It tends to add to success when the involved engineers do like what is going on. |
Jorgen Grahn <grahn+nntp@snipabacken.se>: Nov 18 08:30AM On Mon, 2014-11-17, Richard wrote: > One might as well ask: > Since C++ can be transformed into C, what is the point? > The point is that using C++ allows us to get the job done at a higher ... [snip] You seem to misunderstand my question: I don't question the usefulness of C++ or C++11. My question above was What would be the point of automating it? ^^^^^^^^^^^^^^^^ /Jorgen -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o . |
legalize+jeeves@mail.xmission.com (Richard): Nov 18 05:48PM [Please do not mail me a copy of your followup] Jorgen Grahn <grahn+nntp@snipabacken.se> spake the secret code >You seem to misunderstand my question: I don't question the usefulness >of C++ or C++11. My question above was > What would be the point of automating it? Automated refactorings can be applied over a large code base quickly and are (usually) less error prone. Specifically, with clang-modernize you should read the documentation on the provided refactorings. Not all of them are perfect; replacing auto_ptr with unique_ptr or applying the call-by-value transformations might best be applied with some oversight. Some people consider excessive use of 'auto' to be obfuscating. I'm not aware of anyone complaining about the range for loop transformation however. Having done lots of refactoring of C++ code by hand, I can tell you that being able to apply refactorings in an automated manner is almost always preferable. The only caveat is that you have to be able to trust your refactoring tool. Many refactoring tools do refactorings on an ad-hoc basis and can introduce errors. This is why I created a test suite for C++ refactoring tools: <https://github.com/LegalizeAdulthood/refactor-test-suite> <http://legalizeadulthood.wordpress.com/2014/06/13/refactoring-test-results-for-vax-10-8-2036-0-built-2014-05-22/> <http://legalizeadulthood.wordpress.com/2010/02/02/c-refactoring-tools-test-suite-available/> Since clang-modernize uses a *real* C++ parser that is used by a production quality compiler in order to extract information about the source code, it is much more reliable and trustworthy than tools that use ad-hoc parsing or a parser that isn't used to actually compile real-world C++ code. -- "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline> The Computer Graphics Museum <http://computergraphicsmuseum.org> The Terminals Wiki <http://terminals.classiccmp.org> Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com> |
Louis Krupp <lkrupp@nospam.pssw.com.invalid>: Nov 18 08:37AM -0700 On Mon, 17 Nov 2014 13:52:51 -0800 (PST), Robert Hutchings <rm.hutchings@gmail.com> wrote: <snip> >Louis, how did you get the PDF download AND the paperback book? Was this on http://shop.oreilly.com? Yes. I followed the link in your original post (thank you for that, by the way), and I clicked on "Print & Ebook" under "Buying Options" on the top right. Louis |
Robert Hutchings <rm.hutchings@gmail.com>: Nov 18 09:55AM -0600 On 11/18/2014 9:37 AM, Louis Krupp wrote: > by the way), and I clicked on "Print & Ebook" under "Buying Options" > on the top right. > Louis Okay, I didn't see that. Maybe I can still get the book if I have purchased the PDF download... |
David Brown <david.brown@hesbynett.no>: Nov 18 09:23AM +0100 On 17/11/14 18:30, red floyd wrote: >> analysis tool. >> http://cppcheck.sourceforge.net/ > And isn't splint still around, too? I don't think splint ever handled C++. And to my knowledge, its development stalled over 10 years ago. |
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