background preloader

C++

Facebook Twitter

C++ FAQ. Tour. Optimizing C++ Code - Visual C++ Team Blog. Ten C++11 Features Every C++ Developer Should Use. This article discusses a series of features new to C++11 that all developers should learn and use. There are lots of new additions to the language and the standard library, and this article barely scratches the surface.

However, I believe some of these new features should become routine for all C++ developers. You could probably find many similar articles evangelizing different C++11 features. This is my attempt to assemble a list of C++ features that should be a norm nowadays. Table of contents: auto Before C++11 the auto keyword was used for storage duration specification. Auto i = 42; auto l = 42LL; auto p = new foo(); Using auto usually means less code (unless your type is int which is one letter shorter). Std::map<std::string, std::vector<int>> map; for(auto it = begin(map); it !

You should note that auto cannot be used as the return type of a function. Template <typename T1, typename T2> auto compose(T1 t1, T2 t2) -> decltype(t1 + t2) { return t1+t2; } auto v = compose(2, 3.14); Parallel Studio XE 2013. Project Blog: Clang support for C++11 and beyond. As of r179861 , Clang implements the entirety of the C++11 language standard. The following features have been implemented since the release of Clang 3.2, along with our plans for "C++1y". Support for [[attributes]] C++11's [[attribute]] syntax is now fully supported, including support for the standard [[noreturn]] and [[carries_dependency]] attributes (although [[carries_dependency]] does not provide improved code generation).

This allows non-returning functions to be written with a standard syntax: [[noreturn]] void foo() { while (true) do_something(); } Just like __attribute__((noreturn)) , Clang will warn you if you use this attribute on a function which can return, and will optimize callers on the assumption that the function does not return. As with g++'s implementation, __attribute__((foo)) attributes which are supported by g++ can be written as [[gnu::foo]] . Clang also now provides complete support for C++11's almost-attribute alignas(...) . Inheriting constructors ... as ... Cello • High Level Programming C. CINT | ROOT. What is CINT? CINT is an interpreter for C and C++ code. It is useful e.g. for situations where rapid development is more important than execution time. Using an interpreter the compile and link cycle is dramatically reduced facilitating rapid development.

CINT makes C/C++ programming enjoyable even for part-time programmers. CINT is written in C++ itself, with slightly less than 400,000 lines of code. It is used in production by several companies in the banking, integrated devices, and even gaming environment, and of course by ROOT, making it the default interpreter for a large number of high energy physicists all over the world. Features CINT covers most of ANSI C (mostly before C99) and ISO C++ 2003. Download CINT is free software in terms of charge and freedom of utilization: it is licensed under the X11/MIT license. The source of CINT 5.18.00 from 2010-07-02 is available here (tar.gz, 2MB). To build the source package do: $ tar xfz cint-5.16.19-source.tar.gz $ cd cint-5.16.19 $ . Visual C++ The Visual C++ language and development tools help you develop native Windows Store apps, native desktop apps, and managed apps that run on the .NET Framework.

Windows Store Apps Find guides and reference content on the Windows Developer Center. For information about developing Windows Store apps, see Develop Windows Store apps using Visual Studio and Roadmap for Windows Store apps using C++. Win32 Desktop Apps (Visual C++) Learn how to create desktop applications that have a message loop and callbacks. DLLs in Visual C++ Find out how to use Win32, ATL, and MFC to create Windows desktop DLLs, and provides information about how to compile and register your DLL. Parallel Programming in Visual C++ Learn how to use the Parallel Patterns Library, C++ AMP, OpenMP, and other features that are related to multithreading on Windows. Security Best Practices for C++ Learn how to protect applications from malicious code and unauthorized use. Specialized Tasks (Visual C++) Reference Concepts Other Resources. Unit Test Basics. Visual Studio Test Explorer is designed to support developers and teams who incorporate unit testing in their software development practices.

Unit testing helps you ensure the correctness of your program by verifying that the application code does what you expect it to do. In unit testing, you analyze the functionality of your program to discover discrete testable behaviors that you can test as individual units. You use a unit testing framework to create tests of those behaviors and to report the results of those tests.

Unit testing has the greatest effect when it’s an integral part of your software development workflow. As soon as you write a function or other block of application code, you create unit tests that verify the behavior of the code in response to standard, boundary, and incorrect cases of input data, and that verify any explicit or implicit assumptions made by the code.

In this topic, we use the development of a fictional application called MyBank as an example. Unit test for unmanaged C++ in Visual Studio ~ Code Ketchup. Bugs free software is a dream of every person who involve in software development process. But with the today complex software systems and even more featured requirements , it is quite a challenge to overcome this specific expectation. There are number of methodologies and tools for bug tracking, debugging, error tracing and various level to testing. But as the developers unit testing and integrated testing are the most important kind of testing that require to implement a bug free software. So in this article I'm going to show you some tips and methodologies of unit testing. Most of the Unmanaged C++ developers developers mostly use some kind of third party Unit Test frame-works such as 'Boost Test', 'Google Test' or 'cppUnit' even they works on windows environment.

Today I'm going to develop a simple calculator with unit testing for the functionality. Add Main Project 1. 5. So this is our main project and main method should be in this project for initiate the application. 7. 1. 8. 3. C++11 Rocks - Visual Studio 2010 Edition. Code complexity giving you a headache? Worried that your app isn’t fast enough? You know you could write better code if you used the new C++11 features, but you can’t find the time to learn them. Or maybe you think that they are going to be complicated to learn. Or maybe you haven’t seen a good book about the new C++. VS2010 allows you to write better code If you do get over the learning curve, Visual Studio 2010 gives you the opportunity to use C++11 features to make your code significantly cleaner and easier to read, and to improve performance as well.

But which features are there? In reality, valid C++11 code sometimes fails to compile in VS2010, or worse, causes crashes or wrong results at runtime. So how can you learn C++11? You could read books, but the available books span the entire C++ language, run to a 1000 pages or more, and only manage to scratch the surface. Learn the easy way with C++11 Rocks You can master the C++11 features in VS2010 with this book. Readers say… It’s all about performance: Using Visual C++ 2012 to make the best use of your hardware | Build 2012.