Topics Search

C and C++

Home » C and C++ (739)
  • Page 1 of 37
  • »
 

Rethrowing exceptions

Rethrowing exceptions Icon
Occasionally you may run into a case where you want to catch an exception, but not want to (or have the ability to) fully handle it at the point where you catch it. This is common when you want to log an error, but pass the issue along to the caller to actually handle.
 
Advertisement:
 

C# Back to Basics: Static Constructors

C# Back to Basics: Static Constructors Icon
Today, let's turn our attention to a very basic, and highly useful feature of C#: Static Constructors. I don't make common use of this feature myself. But, when it is needed, it fits the job very well indeed. So, what is a static constructor? To quote the documentation, "A static constructor is used to initialize any static data, or to perform a particular action that needs to be performed once only."
 

Getting Started with C++ for Eclipse

Getting Started with C++ for Eclipse Icon
C++ is a C-based programming language that provides a direct mapping of hardware features and a low-level memory manipulation, and is also a general purpose programming language that could be used in various contexts. C++ inherits from C and also introduces object-oriented programming features with the use of classes that provide the common OOP features of abstraction, encapsulation, inheritance, and polymorphism. C++ is ranked as the third most commonly used programming language by TIOBE Index of programming languages. C++ could be used in various IDEs, such as Visual Studio, Eclipse, and NetBeans. In this tutorial, we shall get started with using C++ in Eclipse IDE. This tutorial has the following sections.
 

Function template specialization

Function template specialization Icon
When instantiating a function template for a given type, the compiler stencils out a copy of the templated function and replaces the template type parameters with the actual types used in the variable declaration. This means a particular function will have the same implementation details for each instanced type (just using different types). While most of the time, this is exactly what you want, occasionally there are cases where it is useful to implement a templated function slightly different for a specific data type.
 

Uncommon but useful GCC command line options

Uncommon but useful GCC command line options Icon
The gcc compiler offers a seemingly never-ending list of command line options. Of course, no body uses or has expertise on all of them, but there are a select bunch that every gcc user should - if not must - know. While some of them are commonly used, others are a bit uncommon but no less useful. In this article series, we are focusing on some of those uncommon but useful gcc command line options, and have already covered a couple of them in the part 1.
 

Dynamic casting

Dynamic casting Icon
In this lesson, we’ll continue by examining another type of cast: dynamic_cast. When dealing with polymorphism, you’ll often encounter cases where you have a pointer to a base class, but you want to access some information that exists only in a derived class.
 

Getting started with Roslyn: transforming C# code

Getting started with Roslyn: transforming C# code Icon
Making a programming language actually useful is not simply about designing it well but it is also about providing supporting tools around the language: compilers, obviously, but also editors, build systems, etc. There are few languages that give you tools to play under the hood. I am thinking about the Language Server Protocol for example.
 

Understanding C++ Containers in the C++ Standard Library

Understanding C++ Containers in the C++ Standard Library Icon
Containers classes are those that provide the means to hold elements and facilitates and have some sort of management and manipulation over it. When we talk about containers, the first thing that comes to mind is of Standard Template Library (STL). STL supplies quite a few sophisticated container implementations. Started as a separate library, STL heavily influenced the derivatives of container classes of the C++ standardized library in its present from. Though the standard library is a collection of many other functionalities apart from providing container classes, here we'll focus on container classes only.
 

Adding a new measure in C#

Adding a new measure in C# Icon
This article describes how to add a measure to a Tabular model already deployed on Analysis Services by using C# or PowerShell. This can be useful to deploy user-defined metrics without deploying the entire database. I worked in several Analysis Services projects where certain metrics were developed outside of the regular database modeling development process. There are many examples for that:
 

How to get the CommandLine of the Current Application in C# ?

How to get the CommandLine of the Current Application in C# ? Icon
You might need to get the information that contains the commandline which is used to execute the current application in C#. How to get the CommandLine of the Current Application in C# ? You can use the CommandLine property of the System.Environment class that provides the necessary information including the application name.
 

How to get the Machine Name from a .NET Application using C# ?

How to get the Machine Name from a .NET Application using C# ? Icon
You can use the MachineName property defined in the System.Environment class in order to get the Machine Name from your .NET Application. How to get the Machine Name from a .NET Application using C# ? Here’s a code sample demonstrating how to do it.
 

How to Get the number of elements in ArrayList in C# ?

How to Get the number of elements in ArrayList in C# ? Icon
Here’s the code that demonstrates how one can get the total number of elements contained in the ArrayList using C# using the Count property of the ArrayList.
 

How to Add range of elements to ArrayList in C# ?

How to Add range of elements to ArrayList in C# ? Icon
You can use the AddRange method of the ArrayList object to add the range of elements (string array) to ArrayList in C#. How to Add range of elements to ArrayList in C# ? Here’s the code that demonstrates how to do it.
 

How to Check if the ArrayList is read-only in C# ?

How to Check if the ArrayList is read-only in C# ? Icon
There are times when you would use the read-only wrapper in order to prevent modifying the ArrayList. We use the ArrayList.ReadOnly method to create such collection. When doing so , you might want to check if the ArrayList is Read-only or not.
 

How to get the Number of Elements in an Array in C# ?

How to get the Number of Elements in an Array in C# ? Icon
You can use the Length property of the array to return the number of elements in it. Note that once the array is created , you cannot change its length. How to get the Number of Elements in an Array in C# ? Here’s a code snippet demonstrating the usage of the Length property of the array to get the number of elements.
 

How to get the Number of Elements in an MultiDimensional Array in C# ?

How to get the Number of Elements in an MultiDimensional Array in C# ? Icon
In one of the previous articles , we demonstrated the usage of the Length property of the array in C# to get the number of elements in it. In this post , lets have a look at getting the number of elements in the multi-dimentional array in C#. How to get the Number of Elements in an MultiDimensional Array in C# ? If you wanted to find out the total number of elements in the multi-dimensional array , you can use the GetLength method of the array and specify the dimension as parameter as shown in the code snippet.
 

How to use array Rank in C# ?

How to use array Rank in C# ? Icon
In C# , the Rank property of the array is is used to get the rank of the array. In simple terms , rank refers to the number of dimensions of the array. How to use array Rank in C# ? You can get the number of dimensions of the array using the Rank property of the array. For instance , the Rank property of the 1-D array results in the value 1 whereas the 2-D array results in the rank value of 2.
 

3 Example Programs to Understand C++ STL Stack Implementation

3 Example Programs to Understand C++ STL Stack Implementation Icon
In programming language, stack is a data structure that has few interesting properties. Its elements are added as you get them, and you empty the stack from last element that you have added into it. Stack is also known as LIFO, which stands for “Last In First Out”.
 

WinForm Barcode Reader with Webcam and C#

WinForm Barcode Reader with Webcam and C# Icon
When building a .NET application to read barcodes on Windows via camera, you need two types of SDKs – one for webcam, and the other for barcodes. In this post, I want to share how to use .Net webcam and barcode SDKs to create a simple WinForm barcode reader application in C#.
 

MIDI Enhancements in Windows 10

MIDI Enhancements in Windows 10 Icon
As Windows 10 evolves, we are continuing to build in support for musician-focused technologies. Let’s take a look at MIDI. Windows has had built-in MIDI support going back to the 16-bit days. Since then, most MIDI interfaces have moved to USB and our in-box support has kept pace, with a class driver and APIs that support those new interfaces.
Home » C and C++ (739)
  • Page 1 of 37
  • »