C

Commonly used GCC Compiler Flags

GNU Compiler Collection (GCC) is an optimizing compiler produced by the GNU Project supporting various programming languages, hardware architectures and operating systems. It includes front ends for C, C++, Objective-C, Fortran, Ada and Go. This article discuss about commonly encountered GCC compiler flags. Disable the unused variable warningsUse flag -Wno-unused-variable [...]

2022-02-22T18:25:20+05:30Categories: IDE|Tags: , |

Boost.Bind | C++

Introduction boost::bind is a generalization of the standard functions std::bind1st and std::bind2nd. It supports arbitrary function objects, functions, function pointers, and member function pointers. Syntax Below syntax bind function with parameters. boost::bind(namespace::functionName, _1, _N); To bind a member function, an instance of an object on which the member function can [...]

2020-02-22T22:13:16+05:30Categories: Programming|Tags: , |

constexpr specifier in C++

constexpr constexpr specifier declares that it is possible to evaluate the value of the function or variable at compile time. The main idea is performance improvement of programs by doing computations at compile time rather than run time. It specifies that the value of an object or a function can [...]

2020-08-27T21:39:28+05:30Categories: Programming|Tags: |

Type Inference | C++

Type Inference refers to automatic deduction of the data type of an expression in a programming language. Before C++ 11, each data type needs to be explicitly declared at compile time, limiting the values of an expression at runtime but after the new version of C++, many keywords are included [...]

2019-09-11T21:29:26+05:30Categories: Programming|Tags: |

typeid operator | C++

The typeid operator returns a const reference to a type_info object that describes type-id or the type of expression. If expression is an lvalue (not a pointer) of a polymorphic class, the type_info of the most-derived class is returned. Otherwise, expression is not evaluated, and the type_info of its static type is returned. Each distinct type has its own associated type_info object, but type synonyms (such as [...]

2019-09-11T21:10:56+05:30Categories: Programming|Tags: |

Enum | C++

Introduction An enumeration is a distinct type whose value is restricted to a range of values, which may include several explicitly named constants ("enumerators"). The values of the constants are values of an integral type known as the underlying type of the enumeration. There are two distinct kinds of enumerations: [...]

2019-09-10T23:27:34+05:30Categories: Programming|Tags: |

l-values and r-values | C++

In C++, variables are a type of l-value (pronounced ell-value). An l-value is a value that has an address (in memory). Since all variables have addresses, all variables are l-values. The name l-value came about because l-values are the only values that can be on the left side of an assignment statement. [...]

2019-09-08T22:21:45+05:30Categories: Programming|Tags: |

Const Qualifier in C

const qualifier in C/C++ can be applied to the declaration of any variable to specify that its value will not be changed.  const keyword applies to whatever is immediately to its left. If there is nothing to its left, it applies to whatever is immediately to its right. Pointer to [...]

2020-09-03T14:38:14+05:30Categories: Programming|Tags: |

Normal function vs Inline function in C

A function is a block of code that performs a specific task. It improves the readability of the code. Syntax Syntax of normal function and inline function is same except that inline function has the keyword inline in its definition. Below is the example showing both function types. #include <iostream> [...]

2020-09-04T16:03:58+05:30Categories: Programming|Tags: |
Go to Top