- We've won! - 8 Updates
- Solutions Manual | Steel Design, 5th Edition by Segui - 1 Update
- Is this sorting predicate ok? - 1 Update
- cmsg cancel <ptbnvj$tj$1@dont-email.me> - 1 Update
- My Parallel C++ Conjugate Gradient Linear System Solver Library that scales very well was updated to version 1.73 - 1 Update
- is_same for parameter pack => is_one_of - 2 Updates
David Brown <david.brown@hesbynett.no>: Nov 24 12:50AM +0100 On 24/11/2018 00:12, Chris M. Thomasson wrote: > [...] > No. acquires_count does not have to be atomic at all. A C11 mtx_t > provides a standard mutex. In C++11, its equivalent is std::mutex. I know that. > C11 > https://en.cppreference.com/w/c/thread/mtx_lock > https://en.cppreference.com/w/c/thread I've read these. I've read the standards too, which are authoritative (though I don't see anything wrong in those linked pages, and my experience is that cppreference.com is very accurate). I don't see anything in these that suggests that there is any kind of synchronisation or ordering enforced on a non-atomic non-volatile variable just because you have a mutex function. The mtx_lock() function synchronises with other mtx_ functions on the same mutex. That is /all/. And in particular, even if mtx_trylock were defined to be a fence, and even if the fence were defined to apply to all memory operations, not just atomic ones (which is how C11 and C++11 fences are defined), it still would not affect the validity of transforming: if (res) { ++acquires_count; } into auto tmp = acquires_count; tmp += res ? 1 : 0; acquires_count = tmp; If I am wrong, show me /exactly/ which paragraphs of the C11 or C++11 standards make this wrong. > language now. Variables protected by the mutex do NOT need to be atomic > at all, no volatile or any crap like that. No extra memory barriers are > needed at all. There are no variables "protected" by a mutex. Mutex's do not "protect" variables. They are locks, which are synchronisation primitives. You can /use/ a mutex to protect access to a variable, but it does not happen by itself. Think about it - how is "mutex" supposed to "know" that it is protecting "acquires_count" ? How is "acquires_count" supposed to "know" that is it protected by "mutex" ? These are independent variables - they are unrelated. And in particular, the code if (res) { ++acquires_count; } is run whether the mutex is acquired or not. Is the mutex so magical that it protects and controls this code even when you fail to get the lock? > int a = 0; > short b = 1; > double c = 0.5; Do you mean these variables to be at file-scope, while the rest of the code is within a function? If the variables are local to a function they will be eliminated entirely by the optimiser. > ____________________ > a, b and c do not need to be atomic types at all. No extra memory > barriers are needed. Period. Wrong. And there is no "period" here - clearly the discussion is not over. In practice, this will work, since there is little to be gained by moving things around in a different way. But the standards and the description of the mtx functions do not guarantee it. |
Melzzzzz <Melzzzzz@zzzzz.com>: Nov 24 12:17AM > In practice, this will work, since there is little to be gained by > moving things around in a different way. But the standards and the > description of the mtx functions do not guarantee it. In practice, this always works... you have to provide *one* example where this does not works and then you got point. That is any claim that assumes for all mathematics say can be debuffed with one counter example... -- press any key to continue or any other to quit... |
David Brown <david.brown@hesbynett.no>: Nov 24 02:13AM +0100 On 24/11/2018 01:17, Melzzzzz wrote: > On 2018-11-23, David Brown <david.brown@hesbynett.no> wrote: >> On 24/11/2018 00:12, Chris M. Thomasson wrote: <snip> > where this does not works and then you got point. That is any claim > that assumes for all mathematics say can be debuffed with one counter > example... No, the onus is on Chris to provide a justification for claiming the code here works as he thinks it does. That should be by pointing to the relevant paragraphs in the standards (preferably C11, as it is smaller and easier to navigate, but C++11 or later would be fine). Failing that, clear documentation in a compiler reference would be useful, as would some sort of official "C++11 memory model" paper. Otherwise "it worked when I tried it" is not worth the pixels it is written on. |
"Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid>: Nov 23 05:17PM -0800 On 11/23/2018 5:13 PM, David Brown wrote: > would some sort of official "C++11 memory model" paper. > Otherwise "it worked when I tried it" is not worth the pixels it is > written on. C11 and C++11 have guarantees on mutex operations. The variables they protect do not need any special decorations. Fwiw, a lock on a std::mutex basically implies acquire semantics. An unlock implies release. A conforming C11 or C++11 compiler shall honor the semantics of a mutex. Period. Anything else, is non-conforming. End of story. |
James Kuyper <jameskuyper@alumni.caltech.edu>: Nov 24 12:25AM -0500 On 11/23/18 20:17, Chris M. Thomasson wrote: ... > C11 and C++11 have guarantees on mutex operations. The variables they > protect do not need any special decorations. What specifies which variables they protect? What is the nature of the protection that they provide to those variables? I've reviewed every line of the standard containing the word "mutex" without seeing any hint of an answer to either of those questions - what did I miss? |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Nov 24 06:42AM +0100 On 24.11.2018 06:25, James Kuyper wrote: > protection that they provide to those variables? I've reviewed every > line of the standard containing the word "mutex" without seeing any hint > of an answer to either of those questions - what did I miss? Mutexes are used to provide exclusive access to variables. It's up to the programmer to establish the guard relationship. >> std::mutex basically implies acquire semantics. An unlock implies >> release. A conforming C11 or C++11 compiler shall honor the semantics of >> a mutex. Period. Anything else, is non-conforming. End of story. Cheers & hth., - Alf |
Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo>: Nov 23 02:51AM -0500 Chris M. Thomasson wrote: > Well, there was a problem with a GCC optimization that broke a POSIX mutex. It > was an old post on comp.programming.threads: > https://groups.google.com/d/topic/comp.programming.threads/Y_Y2DZOWErM/discussion I have never read that discussion before and got interested by your mentioning of it. I found the claims of people who believed that acquiring POSIX mutex is somehow supposed to protect some "associated" variable highly dubious. Just in case, I double-checked and could not find any such guarantee in my copy of POSIX standard (The Open Group Base Specifications Issue 6 IEEE Std 1003.1, 2004 Edition). AFAIK (and I has been using POSIX synchronization primitives for decades), the only thing that successful locking of a posix mutex by a thread guarantees is that no other thread has or will have that mutex locked until the first thread releases it. How to use this guarantee is entirely up to the programmer. In particular, I believe that the OP's code was buggy if the intention was to maintain a total count of successful locks by all threads in `acquires_count' variable, exactly because the programmer did not take responsibility for memory access sequencing. Respectively, IMHO the code optimization by GCC was absolutely legal. |
Tim Rentsch <txr@alumni.caltech.edu>: Nov 24 12:51PM -0800 > type to the type of the actual argument: it's already that type. > So "the argument of the constructor" must be referring to the > constructor's formal argument. I don't think so. The quoted paragraph uses the term "argument" and that does mean "argument" in its usual sense, not "parameter" (or "formal argument" if someone prefers that term). I think you may have missed a subtle but important point being made here. Here is an example to illustrate (disclaimer: just typed in, not compiled, though I have compiled similar examples): class Foo { public: Foo( const long & ){} }; int takes_foo( Foo foo ){ (void) &foo; /* explicitly ignore the value of 'foo' */ return 47; } ... int main(){ return takes_foo( 0 ) != 47; } The return statement in main() makes use of a user-defined conversion sequence that is specified by a constructor. The source type (for 0) is 'int'. The type of the (unnamed and ignored) constructor parameter is 'const long &'. There must be a conversion (or several) to get from the source type to the type of the constructor parameter. The quoted paragraph says "the initial standard conversion sequence converts the source type to the type required by the argument of the constructor". The type required by the argument of the constructor is (in this case) 'long'. The reason it is 'long' and not 'const long &' is that a standard conversion sequence cannot get all the way from 'int' to 'const long &', only to 'long'. The definition of "standard conversion sequence" is given in section 7, paragraph 1 (with sub-paragraphs 1.1, 1.2, 1.3, and 1.4). Notice that it does not include any conversions to get from a prvalue to the parameter type 'const long &'. That step is done by a "temporary materialization conversion", defined in 7.4. So the quoted sentence, in talking about "the initial standard conversion sequence", is referring to an intermediate _argument_ to the constructor, said argument only subsequently being converted to the type of the constructor parameter. There are three types: the source type - int the standard conversion sequence result type - long the parameter type - const long & The quoted paragraph is referring to the second of these, which is the type of an intermediate argument to the constructor, not the type of the parameter in the constructor's definition. |
Evan Jack <evanjackspace5@gmail.com>: Nov 24 12:42PM -0800 Steel Design, 5th Edition by Segui Solutions Manual The Instructor Solutions manual is available in PDF format for the following textbooks. The Solutions Manual includes full solutions to all problems and exercises ( ODD & EVEN ), but please DO NOT REQUEST HERE , instead send an email with details; title, author and edition Of the solutions manual you need to download. NOTE: this service is NOT free. My email: evanjackspace(@)gmail(dot)com Here are some listed... You can search by author's name use Ctrl + F https://forums.adobe.com/thread/2556709 Solutions Manual A Brief Introduction To Fluid Mechanics, 5th Edition by Donald F. Young, Bruce R. Munson, Theodore H. Okiishi and Wade W. Huebsch Solutions Manual A Course in Digital Signal Processing by Porat Boaz. Solutions Manual A First Course in Integral Equations 2nd Ed by Abdul Majid Wazwaz Solutions Manual A First Course in the Finite Element Method, 5th Edition by logan Solutions Manual A Hungerford's Algebra by James Wilson Solutions Manual A Modern Theory of Integration by Bartle R. Solutions Manual A Primer for the Mathematics of Financial Engineering by Dan Stefanica Solutions Manual A Quantum Approach to Condensed Matter Physics by Philip L. Taylor Solutions Manual Abstract Algebra Manual Problems and Solutions by Ayman Badawi Solutions Manual Accounting Information Systems 12th Edition by Romney, Steinbart Solutions Manual Accounting Principles, 9th Edition by Weygandt Solutions Manual Accounting, 25th Ed by Warren Solutions Manual Actuarial Mathematics by Gauger M.A. Solutions Manual Actuarial Mathematics for Life Contingent Risks by Dickson, Hardy and Waters Solutions Manual Advanced Accounting 10th ED by Fischer, Cheng, Taylor Solutions Manual Advanced Accounting 11th Edition by Joe Ben Hoyle Solutions Manual Advanced Accounting 4th Ed by Jeter Solutions Manual Advanced Accounting 8th edition by Beams, Anthony, Clement, Lowensohn Solutions Manual Advanced Accounting Vol 2 ( 2006 ) by Baysa, Lupisan Solutions Manual Advanced Calculus A Geometric View by James J. Callahan Solutions Manual Advanced Engineering Electromagnetics, 2nd Edition by Constantine A. Balanis Solutions Manual Advanced Engineering Mathematics 2nd Edition by Michael D. Greenberg Solutions Manual Advanced Engineering Mathematics 5th Edition by Zill Solutions Manual Advanced Engineering Mathematics by Herbert Kreyszig, Erwin Kreyszig Solutions Manual Advanced Engineering Mathematics, 10th Edition by Erwin Kreyszig Solutions Manual Advanced Engineering Mathematics, 7th Ed by Peter V. O'Neil Solutions Manual Advanced Financial Accounting 8 Ed by Baker Solutions Manual Advanced Functions & Introductory Calculus by Kirkpatrick, McLeish, Montesanto Solutions Manual Advanced Mathematical Concepts Precalculus with Applications ( Glencoe ) Solutions Manual Advanced Organic Chemistry Part A Structure and Mechanisms 5th Edition by Francis A. Carey, Richard J. Sundberg Solutions Manual Advanced Organic Chemistry Part B Reactions and Synthesis 5th Edition by Francis A. Carey, Richard J. Sundberg Solutions Manual Advandced Accounting 8th ED by Fischer Taylor Solutions Manual Algebra & Trigonometry and Precalculus 3rd Edition by Penna & Bittinger Beecher Solutions Manual Algebra and Trigonometry 4th Ed by Robert F. Blitzer Solutions Manual An Introduction to Analysis of Financial Data with R by Ruey S. Tsay Solutions Manual An Introduction to Derivatives and Risk Management by chance, brooks Solutions Manual An Introduction to Difference Equations by Saber Elaydi Solutions Manual An Introduction to Management Science 13th Edition by Anderson Solutions Manual An Introduction To Management Science Quantitative Approaches To Decision Making 12th Ed by Anderson, Sweeney Solutions Manual An Introduction to Mechanics by Kleppner Solutions Manual An Introduction to Numerical Methods and Analysis 2nd Edition by James F. Epperson Solutions Manual An Introduction to Numerical Methods and Analysis, 2nd Ed by James F. Epperson Solutions Manual An Introduction To The Mathematics Of Financial Derivatives 2nd E by Mitch Warachka, Hogan, Neftci Solutions Manual Analysis of Financial Time Series, 3rd Ed by Ruey S. Tsay Solutions Manual Analysis of Transport Phenomena, W. Deen Solutions Manual Analysis, Synthesis,and Design of Chemical Processes 3rd ED by Turton, Shaeiwitz Solutions Manual Applied Analyses in Geotechnics by Fethi Azizi Solutions Manual Applied Business Statistics Methods and Excel-based 4th Edition Applications by Trevor Wegner Solutions Manual Applied Calculus For Business, Economics, And The Social And Life Sciences, Expanded 10th Edition by Hoffmann, Laurence D, Rosen, Kenneth H. Solutions Manual Applied Econometric Times Series, 3rd Edition by Walter Enders Solutions Manual Applied Electromagnetism 2nd Ed by Shen, Huang Solutions Manual Applied Linear Algebra by Olver, Shakiban Solutions Manual Applied Linear Statistical Models 5th Ed by Kutner, Nachtsheim Solutions Manual Applied Mathematics, 3rd Ed by J. David Logan Solutions Manual Applied Quantum Mechanics by Levi A.F.J. Solutions Manual Applied Statistics and Probability for Engineers 6th Ed by Montgomery, Runger Solutions Manual Artificial Intelligence A Modern Approach 3rd Edition (International Version) by Russell, Norvig Solutions Manual Atkins and Jones's Chemical Principles The Quest for Insight 5th Edition by John Krenos, Joseph Potenza, Laurence Lavelle, Yinfa Ma, Carl Hoeger Solutions Manual Atkins' Inorganic Chemistry 6th ED by Alen Hadzovic Solutions Manual Automation, Production Systems, and Computer Integrated Manufacturing 3rd ED by Mikell P. Groover Solutions Manual Basic College Mathematics An Applied Approach, 10th Edition by Richard N. Aufmann, Joanne Lockwood Solutions Manual Basic econometrics 4th ED by Damodar N. Gujarati Solutions Manual Basic Engineering Circuit Analysis, 9th Ed by Irwin, Nelms Solutions Manual Basic Engineering Mathematics by Chan, Hung Solutions Manual Basic Principles and Calculations in Chemical Engineering 7th E by Himmelblau, Riggs Solutions Manual Beginning C++ Through Game Programming 2nd Edition by Michael Dawson Solutions Manual Beginning Partial Differential Equations 3rd ED by Peter V. O'Neil Solutions Manual Biochemistry 5th ED by H. Garrett, M. Grisham Solutions Manual Business And Transfer Taxation 3rd E By Valencia Roxas Solutions Manual Business Statistics in Practice 7th ED by Bowerman, O'connell, Murphree Solutions Manual Business Statistics in Practice by Bruce Bowerman, Richard O. Connell, Emilly Murphree Solutions Manual C How to Program, 4th Ed by Deitel & Deitel Solutions Manual C++ for Computer Science and Engineering 3rd ED by Vic Broquard Solutions Manual C++ How to Program 7th Ed by Deitel Solutions Manual Calculus 8th Edition by Varberg, Purcell, Rigdon Solutions Manual Calculus & Its Applications BRIEF CALCULUS & ITS APPLICATIONS 13th Edition by Larry J. Goldstein, David C. Lay, David I. Schneider, Nakhle H. Asmar Solutions Manual Calculus 10th Ed by Larson,Edwards Solutions Manual Calculus a Complete Course 7th Edition by R. Adams and C. Essex Solutions Manual Calculus A Complete Course 8th Edition by by R.A. Adams, Essex Solutions Manual Calculus by Robert Ellis, Denny Gulick Solutions Manual Calculus Early Transcendental Functions 3rd Edition by Robert T Smith, Roland B Minton Solutions Manual Calculus Early Transcendental Functions 4th Edition by Smith, Minton Solutions Manual Calculus Early Transcendental Functions 6th Edition by Larson, Edwards Solutions Manual Calculus early transcendentals 10th Ed, by Anton Bivens Davis Solutions Manual Calculus early transcendentals 10th Ed, by Anton Bivens Davis Solutions Manual Calculus Early Transcendentals 2nd Edition by William L. Briggs, Lyle Cochran, Bernard Gillett Solutions Manual Calculus Early Transcendentals 6th Ed by Edwards, Penney Solutions Manual Calculus Early Transcendentals 7th Edition by C. Henry Edwards, David E. Penney Solutions Manual Calculus Early Transcendentals by Sullivan, Miranda Solutions Manual Calculus Early Transcendentals, 10th Edition by Howard Anton, Irl C. Bivens, Stephen Davis Solutions Manual Calculus for Engineers 4th Edition by Donald Trim Solutions Manual Calculus One And Several Variables 10th Edition by S Salas Solutions Manual Calculus with Analytic Geometry by Harley Flanders Solutions Manual Calculus with Applications 10th Ed by Lial, Greenwell, Ritchey Solutions Manual Calculus, Single and Multivariable, 6th Edition Vol 1& Vol 2 by Hughes-Hallett, McCallum Solutions Manual Calculus, Single and Multivariable, by Blank, Krantz Solutions Manual Calculus, Single Variable, Multivariable, 2nd Edition by Blank & Krantz Solutions Manual Chemical Engineering Design 4th Ed by Sinnott Solutions Manual CHEMICAL ENGINEERING VOL 1 , VOL 2 , VOL 3 by J. M. COULSON & J. F. RICHARDSON Solutions Manual Chemical Principles 6th Ed by Steven S. Zumdahl Solutions Manual Chemical Principles The Quest For Insight 4th Edition by John Krenos Solutions Manual Chemical Reaction Engineering 3rd ED by Octave Levenspiel Solutions Manual Chemistry - The Central Science 11th ED by Wilson, Illinois Solutions Manual Chemistry 2nd edition by K. C. Timberlake Solutions Manual Chemistry for Today General, Organic, and Biochemistry 8th Edition by Seager, Spencer L., Slabaugh, Michael R Solutions Manual Chemistry for Today, 8th Edition Cengage Learning by Seager, Spencer L., Slabaugh, Michael R Solutions Manual Chemistry Structure and Properties by Kathleen Thrush Shaginaw Solutions Manual Chemistry The Molecular Nature of Matter and Change 4th Edition by Silberberg M. Solutions Manual Chemistry, 10th ED by Whitten, Davis, Stanley Solutions Manual Chemistry, 7th Edition by Susan A. Zumdahl Solutions Manual Chemistry, 9th Edition by Susan A. Zumdahl Solutions Manual Classical Electrodynamics 2nd ED by John David Jackson Solutions Manual Classical Electromagnetic Radiation 3rd Edition by Mark A. Heald, Jerry B. Marion Solutions Manual Classical Geometry_ Euclidean, Transformational, Inversive, and Projective by I. E. Leonard, J. E. Lewis, A. C. F. Liu, G. W. Tokarsky Solutions Manual College Algebra Graphs and Models 5th Edition by Judith A. Penna Solutions Manual College Physics 10th Edition VOL 1 by Serway & Vuille Solutions Manual College Physics 10th Edition VOL 2 by Serway & Vuille Solutions Manual College Physics 4th Edition by Alan Giambattista, Betty Richardson, Robert C. Richardson Solutions Manual College Physics 4th Edition by Giambattista Solutions Manual College Physics 9th ED by Serway,Vuille (Teague) Solutions Manual College Physics 9th Edition by HUGH D. YOUNG Solutions Manual College Physics A Strategic Approach, VOL 1, 2nd ED by Knight, Jones Solutions Manual College Physics, Reasoning and Relationships 2nd Edition VOL1 & VOL2 by Giordano Solutions Manual Communication Systems 4th Edition by Simon Haykin Solutions Manual Communication Systems 4th Edition by Simon Haykin Solutions Manual Computer Organization and Architecture: Designing for Performance 8th Ed by William Stallings Solutions Manual Computer Systems- A Programmer's Perspective by Bryant, O'Hallaron Solutions Manual Concepts of Programming Languages 8th Edition by Sebesta Solutions Manual Contemporary Abstract Algebra by Joseph Gallian Solutions Manual Contemporary Linear Algebra by Anton, Busby Solutions Manual Control Systems Engineering 7th Edition by Norman S. Nise Solutions Manual Control Systems Engineering, 6th ED by Norman Nise Solutions Manual Convection Heat Transfer by Adrian Bejan and J. A. Jones Solutions Manual Convex Optimization by Stephen Boyd,Lieven Vandenberghe Solutions Manual Corporate Finance 10th Edition by Ross, Westerfield, Jaffe Solutions Manual Cost Accounting 14th ED by William K. Carter Solutions Manual Cost Accounting A Managerial Emphasis 14th Edition by Charles T. Horngren, Srikant M. Datar, Madhav V. Rajan Solutions Manual Coulson & Richardson's Chemical Engineering (Vol 2 - 5th Ed) & (Vol 3 - 3rd Ed) by BACKHURST, HARKER Solutions Manual Counting 2nd Edition by Khee Meng Koh, Eng Guan Tay Solutions Manual Data Mining - Concepts and Techniques 2nd Edition by Han, Kamber Solutions Manual Data Networks 2nd Edition by Dimitri Bertsekas, Robert Gallager Solutions Manual Data Structures and Algorithm Analysis in C 2nd ED by Weiss Solutions Manual Deformation and Fracture Mechanics of Engineering Materials 5th Ed by Hertzberg, Vinci Solutions Manual Derivatives - Principles & Practice by Sundaram , Das Solutions Manual Design and Analysis of Experiments 8th Ed by Douglas C. Montgomery Solutions Manual Design of Concrete Structures 13th Edition by Nilson, Darwin, Dolan Solutions Manual Design of Concrete Structures 14th Edition by Nilson, Dolan Solutions Manual Design of Machinery 5th Edition by Norton Solutions Manual Design of Reinforced Concrete 9th Edition by Jack C. McCormac and Russell H. Brown Solutions Manual Design with Constructal Theory by Adrian Bejan, Lorente Solutions Manual Devore's Probability and Statistics for Engineering and the Sciences, 7th Edition by Jay L. Devore, Matthew A. Carlton Solutions Manual Differential Equations and Dynamical Systems 3rd Edition by Lawrence Perko Solutions Manual Differential Equations and Linear Algebra, 3rd Edition by C. Henry Edwards, David E. Penney Solutions Manual Digital Communication 2nd Edition by Edward A. Lee, David G. Messerschmitt Solutions Manual Digital Communication 3rd ED by Barry, Lee, Messerschmitt Solutions Manual Digital Communications 4th ED by Simon Haykin Solutions Manual Digital Communications 5th Edition by Kostas Stamatiou, Proakis Salehi Solutions Manual Digital Communications 5th Edition by Kostas Stamatiou, Proakis Salehi Solutions Manual Digital Communications 5th Edition by Proakis Solutions Manual Digital Fundamentals 10th Ed., by Thomas L. Floyd Solutions Manual Digital Signal Processing 3rd Ed by Proakis, Manolakis Solutions Manual Digital Signal Processing System Analysis and Design by Paulo S. R. Diniz, Eduardo A. B. da Silva, Sergio L. Netto Solutions Manual Discovering Advanced Algebra - An Investigative Approach Solutions Manual Discrete Mathematics 3rd ED by Goodaire, Parmenter Solutions Manual Discrete Mathematics 5th Ed by Dossey, Otto, Spence, Eynden Solutions Manual Discrete Mathematics and its Application 7th Edition by Kenneth H Rosen Solutions Manual Discrete Mathematics with Applications 3rd ED by Susanna S. Epp Solutions Manual Discrete Mathematics with Applications 4th Edition by Susanna S. Epp Solutions Manual Discrete Time Control Systems 2nd Edition by Ogata Solutions Manual Discrete-Event System Simulation 3rd Ed by banks Solutions Manual Econometric Analysis of Cross Section and Panel Data 2nd Edition by Jeffrey M. Wooldridge Solutions Manual Econometrics 2nd Edition by Badi H. Baltagi Solutions Manual Econometrics 3rd Edition by Badi H. Baltagi Solutions Manual Econometrics by Professor Badi H. Baltagi Solutions Manual Elasticity - Theory, Applications and Numerics 2nd ED by Martin H. Sadd Solutions Manual Electric Circuits 10th Ed by Nilsson, Riedel Solutions Manual Electric Machinery Fundamentals 4th Edition by Stephen J Chapman Solutions Manual Electric Machinery Fundamentals 5th Ed by Chapman Solutions Manual Electric Machines and Drives - A First Course by Ned Mohan Solutions Manual Electrical Engineering - Principles and Applications 5E Hambley Solutions Manual Electricity and Magnetism by Edward Purcell Solutions Manual Electrochemical Methods 2nd Edition by Allen J. Bard and Larry R. Faulkner and Cynthia G. Zoski and Johna Leddy |
Tim Rentsch <txr@alumni.caltech.edu>: Nov 24 11:43AM -0800 > others. (Although I prefer to introduce temporaries for complex > expressions.) > 3. Enough people seem to feel that way, or gcc wouldn't warn. I have a different reaction. Certainly the attitude you describe is common. That is regrettable, especially for these operators, which are placed where many or most programmers would expect them to be, following a well-established mathematical custom going back at least to the 1800's. Moreover these particular operators have the same relative precedence in essentially all programming languages (the only exceptions I'm aware of are APL and Smalltalk, which have just one precedence level for all binary operators). [Note: strictly speaking I believe neither APL nor Smalltalk has short-circuiting binary logical operators, but I'm glossing over that aspect.] More generally, this sentiment appears to be a holdover from a time 60 years ago, when compilers, languages, and documentation could not be trusted to be accurate or correct. To me it seems like the same attitude that produces sloppy code, habits like making arrays "a little bigger" than they need to be. The C language has had exactly the same operator ordering for 40 years (and maybe more, but K&R came out in 1978). Anyone who is capable enough to be a competent programmer can easily learn those rules in about 15 minutes. I believe the programming community would do well to adopt the attitude that any serious C programmer should be expected to have learned C's precedence rules (and similarly for C++, at least for those parts where C and C++ are the same). It could be helpful to have a "meeting-of-the-minds" discussion to decide where the dividing line should be for which aspects should be expected to be known and which are more esoteric. To me though the relative precedences of relational/equality operators, the && operator, and the || operator, are clearly and emphatically well inside the line of what should be expected of any serious C or C++ programmer. |
Elephant Man <conanospamic@gmail.com>: Nov 24 04:45PM Article d'annulation posté via Nemo. |
Horizon68 <horizon@horizon.com>: Nov 24 06:41AM -0800 Hello, My Parallel C++ Conjugate Gradient Linear System Solver Library that scales very well was updated to version 1.73 You can read about it and download it from my website here: https://sites.google.com/site/scalable68/scalable-parallel-c-conjugate-gradient-linear-system-solver-library Thank you, Amine Moulay Ramdane. |
robert badea <badea.robert92@gmail.com>: Nov 24 04:17AM -0800 Hello! I was messing around with C++ and wanted to do a type_trait which would return true if a type is one of the given types. basically, is_same_v<T,T> with variadic. This would remove the following boiler plate struct is_something { static const bool value = false; }; template <> struct is_something<int> { static const bool value = true; }; template <> struct is_something<short> { static const bool value = true; }; template <> struct is_something<long> { static const bool value = true; }; with template<class T> struct is_something { static const bool value = is_one_of<T, int, short, long>; }; I've made the following combinations: 1) template<class Expected, class... Received> inline constexpr bool is_one_of = (std::is_same_v<Expected, Received> || ...); 2) template<class Expected> struct is_one_of_2 { template <class ...Received> static constexpr inline bool exec() { return (std::is_same_v<Expected, Received> || ...); } }; Usage: template<class T> constexpr void exec(T data) { if constexpr(is_one_of<int,int,float> || is_one_of_2<T>::exec<int, float>()) { std::cout << "same"; } else { std::cout << "not same"; } } int main() { exec(32); std::cin.get(); return 0; } I was thinking of templated operator (). First one is the cleanest, but you need to know that the first param is compared to all the others. The second one is just messy. Do you have any idea how can i improve the design ? |
Sam <sam@email-scan.com>: Nov 24 09:21AM -0500 robert badea writes: > I was messing around with C++ and wanted to do a type_trait which would > return true if a type is one of the given types. > Do you have any idea how can i improve the design ? Something like the following. The odd "<= 0" comparison, instead of "> 0" was needed because ">" gets parsed …differently in the context of a template parameter. To check if the given type occurs exactly once, just change that to "!= 1". #include <utility> #include <type_traits> #include <iostream> template<typename T, typename ...Types> struct count_occurences { static constexpr int how_many=((std::is_same_v<T, Types> ? 1:0) + ...); }; template<typename T, typename first_type, typename ...Types> using occurs_in=std::conditional_t< count_occurences<T, first_type, Types...>::how_many <= 0, std::false_type, std::type_type>; int main() { std::cout << occurs_in<int, float, int, double, int>::value << std::endl; std::cout << occurs_in<int, double>::value << std::endl; return 0; } |
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