Found 27104 Articles for Server Side Programming

What is the size of int, long type in C++ standard?

Chandu yadav
Updated on 24-Jun-2020 06:05:04

269 Views

The C++ standard does not specify the size of integral types in bytes. It specifies the minimum range these types must be able to hold.The size in bits can be easily found from the specified minimum range.Not referring to the standard but the commonly used sizes for various platforms are −For 32-bit systems, the standard is ILP32 — that is, int, long and pointer are all 32-bit quantities.For 64-bit systems, the Unix standard is LP64 — long and pointer are 64-bit (but int is 32-bit). The Windows 64-bit standard is LLP64 — long and pointer are 64-bit (but long and ... Read More

What are Aggregates and PODs in C++?

George John
Updated on 11-Feb-2020 12:49:57

496 Views

POD is an acronym in C++ that means plain old data. It is a class/struct that ONLY has member variables and no methods, constructors, destructors, virtual functions, etc. For example, Example#include using namespace std; // POD struct MyStruct {    int key;    string data; }; int main() {    struct MyStruct s;    s.key = 1;    s.data = "hello";    return 0; }The struct MyStruct has no user defined ctor, dtor, etc and hence is a POD.An aggregate is an array or a class with no user-declared constructors, no private or protected non-static data members, no base ... Read More

What is a lambda expression in C++11?

V Jyothi
Updated on 24-Jun-2020 06:06:07

276 Views

C++ STL includes useful generic functions like std::for_each. Unfortunately, they can also be quite cumbersome to use, particularly if the functor you would like to apply is unique to the particular function. So this function that you'll create will be in that namespace just being used at that one place. The solution to this is using anonymous functions.C++ has introduced lambda expressions in C++11 to allow creating anonymous function.example#include #include #include // for_each using namespace std; int main() {    vector myvector;    myvector.push_back(1);    myvector.push_back(2);    myvector.push_back(3);    for_each(myvector.begin(), myvector.end(), [](int x) {     ... Read More

Why do we use extern "C" in C++ code?

Priya Pallavi
Updated on 30-Jul-2019 22:30:22

1K+ Views

You need to use extern "C" in C++ when declaring a function that was implemented/compiled in C.Using extern "C" lets the compiler know that we want to use C naming and calling conventions. This causes the compiler to sort of entering C mode inside our C++ code. This is needed because C++ compilers mangle the names in their symbol table differently than C compilers and hence behave differently than C compilers.

What are POD types in C++?

Arjun Thakur
Updated on 02-Mar-2020 07:55:47

997 Views

POD is an acronym in C++ that means plain old data. It is a class/struct that ONLY has member variables and no methods, constructors, destructors, virtual functions, etc. For example,Example#include using namespace std; // POD struct MyStruct {     int key;     string data; }; int main() {     struct MyStruct s;     s.key = 1;     s.data = "hello";     return 0; }The struct MyStruct has no user-defined ctor, dtor, etc and hence is a POD.

C++11 Overview

George John
Updated on 24-Jun-2020 05:45:04

790 Views

C++11 is the modern C++ standard published in 2011. This brought many major extensions and improvements to the existing language. It was approved by International Organization for Standardization (ISO) on 12 August 2011 and replaced C++03.C++11 was also known as C++0x. This is because, For the next revision, it was supposed that the next Standard after would be done by 2008, but since it was uncertain, it was named C++0x, where the x stood for either 8 or 9. Though planning shifted and it is now called C++11. So, C++0x was the name for the standard before it was published. ... Read More

The Biggest Changes in C++11

Nikitha N
Updated on 24-Jun-2020 05:56:48

132 Views

C++11 was the modern C++ standard published in 2011. This brought many major extensions and improvements to the existing language. Following are the major changes/additions of C++11 −Initializer listsAutomatic type deductionRvalue references and move constructorsconstexpr – Generalized constant expressionsModification to the definition of plain old dataUniform initializationRange-based for loopLambda functions and expressionsAlternative function syntaxExplicit overrides and finalA constant null pointer, nullptrStrongly typed enumerationsRight angle bracket not being treated as an operator at appropriate placesVariadic templatesMultithreading memory modelAdded Hash tables to the STLAdded Regular expressions to the Standard LibraryAdded General-purpose smart pointers like shared_ptr, weak_ptr, etcAnd many more. You can get ... Read More

C++ Standards Support in GCC

Vrundesha Joshi
Updated on 11-Feb-2020 12:54:12

919 Views

GCC supports different dialects of C++, corresponding to the multiple published ISO standards. Which standard it implements can be selected using the -std= command-line option.C++98 − GCC has full support for the 1998 C++ standard as modified in 2003 and renamed to C++03 and some later defect reports.C++11 − GCC 4.8.1 was the first complete implementation of the 2011 C++ standard, previously known as C++0x.C++14 − GCC has full support for the latest revision of the C++ standard, which was published in 2014.C++17 − GCC has experimental support for the next revision of the C++ standard, which is expected to ... Read More

Is C++0x Compatible with C?

Srinivas Gorla
Updated on 30-Jul-2019 22:30:22

94 Views

Neither C++ (98) nor the new standard(C++0x or C++11) is fully compatible with C. C++ never was fully compatible with C.

What are the differences between -std = c++11 and -std = gnu++11?

George John
Updated on 24-Jun-2020 05:45:45

1K+ Views

GNU C++ compiler, g++, provides extensions to the C++ language. The difference between the two options is whether these GNU extensions that might violate the C++ standard are enabled or not. Note that some extensions can still be in effect when using -std = c++11, if they don't violate the standard.The list of extensions to the C++ language in GNU compiler can be found here − https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Extensions.html

Advertisements