[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

C++

57K

Solutions

24K

Contributors

C++ is an intermediate-level general-purpose programming language, not to be confused with C or C#. It was developed as a set of extensions to the C programming language to improve type-safety and add support for automatic resource management, object-orientation, generic programming, and exception handling, among other features.

Share tech news, updates, or what's on your mind.

Sign up to Post

Hey all I am trying my best to fixed these few errors below. The C++ code is from an Arduino library that i wanted to convert to Visual C++ dll for use in one of my C# applications.

These are the areas that have the errors:

void AES::do_aes_encrypt(BYTE *plain,int size_p,BYTE *cipher,BYTE *key, int bits, BYTE ivl [N_BLOCK]){
  calc_size_n_pad(size_p);
  BYTE plain_p[get_size()];
  padPlaintext(plain,plain_p);
  int blocks = get_size() / N_BLOCK;
  set_key(key, bits) ;
  cbc_encrypt(plain_p, cipher, blocks, ivl);
}

Open in new window


The "BYTE plain_p[get_size()];" has the error of "'this' cannot be used in a constant expression".

string AES::letsDecrypt(BYTE *key, string msg, AES aes) {
  char data_decoded[200];
  char iv_decoded[200];
  char temp[200];
  BYTE out[200];
   
  aes.set_key(key, sizeof(key));
  msg.toCharArray(temp, 200);
  int b64len = base64_decode(data_decoded, temp, msg.length());
  string(iv_Encoded).toCharArray(temp, 200);
  
  base64_decode(iv_decoded, temp, string(iv_Encoded).length());  
  aes.do_aes_decrypt((BYTE *)data_decoded, b64len, out, key, 128, (BYTE *)iv_decoded);
  char message[msg.length()];
  char* msgBase64 = (char *)out;
    
  base64_decode(message, (char *)out, msg.length());

  return std::string(message);
}

Open in new window


The "msg.toCharArray(temp, 200);" has the error of "class "std::basic_string<char, std::char_traits<char>, std::allocator<char>>" has no member "toCharArray"".

Another error on the same code above "char message[msg.length()];" has the error of "expression must have a constant value".

And lastly i get this error: "unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?" Which when i try to include it-it says it cant be found.

Help would be great!
0
Bootstrap 4: Exploring New Features
LVL 12
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

Best tool to generate uml diagrams from c++ project on RHEL.  Tried with Bouml. Failed to generate. Deleveloped cross platform compatible code between Linux/Windows.  Compiled on Windows with the help of Cygwin.

What is the easiest method to generate diagrams for every module.  Don't have solution file on Windows.

Please suggest.

Thanks,
Bvm
0
In a code part of a software that I got to update I found a the line

TypeAndTimeZone = UINT16( 1 << 12 | uint16(timeDiff/60));

timeDiff has the negative value -7200.0000

TypeAndTimeZone will get the value: 65416
What kind of numeric value is this because I expected -120.
If I will do
TypeAndTimeZone = TypeAndTimeZone * -1 I will get 120 instead of 65416.

Is 65416 a negative numeric value? Or is there an error to get this as a negative value?
0
I need to learn embedded software and hardware development life cycle and use it to create electronic hardware/software component.  I need to approach this job systematically.  For example, what is the order of tasks.  Probably requirements should be gathered and documented.  Then, what's next and so on?  At what stage should we select hardware components.
0
CWinThread wont exit in Release mode but will in Debug mode visual studio 2017.

Here is what I am doing
CWinThread *ptrDecode = AfxGetThread();
CCriticalSection c_sDecode;
static UINT mDecode(void*);
ptrDecode = NULL;

void myfuction::startThread()
{
      if (ptrDecode == NULL) {
	  ptrDecode = AfxBeginThread(mDecode, this);
	  WaitForSingleObject(ptrDecode, INFINITE);
	}
}

UINT /*WINAPI*/  mDecode(void* pParam)
{
	myfuction* pThis = (myfuction*)pParam;
	CSingleLock lock(&c_sDecode);

	lock.Lock();
	while (1) {
               if (!inputVideo.read(RTSPframe)) {
					//Error
					break;
				}
				
				if (!theApp.RTSPChangeCam) // if == false break out of while loop
					break;

				inputVideo.read(RTSPframe);
				cv::resize(RTSPframe, RTSPResize, cv::Size(RTSPWidth, RTSPHeight), 0, 0, INTER_LINEAR);
				theApp.DX11Images->render();
        }
ptrDecode = NULL;
	theApp.KillDecoder = false;
	lock.Unlock();
	return 0;
}

void myfuction::OnDestroy()
{
	CDialogEx::OnDestroy();
	
	//## make sure nothing is being rendered ##//
	//## kill any RTSP Streams ##//
	theApp.RTSPChangeCam = false;
	while (ptrDecode != NULL) {} // wait until thread exits

}

Open in new window


In OnDestroy() function the while loop waits until ptrDecode == null after theApp.RTSPChangeCam is set to false this cause the while loop in the thread to break and set ptrDecode to null and the dialog then can safely exit this work fine in debug mode and my watch window is showing me that ptrDecode has been set to null but in Release mode ptrDecode dose gets set to null if I place a break point in the thread code but then is reset to not null (seems to get reloaded) when my bullet point hits ptrDecode in the OnDestroy() function, I do not know why this is being re initilized after its been set to null. At no point in my code dose the thread get called again and it only dose it in Release mode.
Is there a setting in my release properties I need to change any help would be great
Regards
Nigel
0
c++ Python program with Minizinc

In this project, you will design and implement a resource management module for an Operating System Simulator ‘oss’. In this project, you will use the deadlock avoidance to manage resources, with processes being blocked on their requests until those requests are safe.
There is no scheduling in this project, but you will be using shared memory so be cognizant of possible race conditions.

Please see the attached files customer has given me piece of codes and SOP document if someone can help me to understand whats the expectation of customer and how to met that expectation i will be very thankful.
1
I have this bit of C Code for a project I working on for a project.  
logit("Username: %s Password: %s", authctxt->user, password);

Open in new window

This is going to be used in a proof of concept project and I want to obscure the real password.  I was thinking of either replacing the whole password with a set of characters or maybe keeping the first and last two characters and replacing the rest with a set of characters.  Maybe Xs.   Looking for suggested modification.
0
I want to retrieve File Description from an exe in Windows. what a structure i need to pass to paremeter 3 of verqueryvalue? when i try to compile i get stFileDescription is undefined.

DWORD dwLen;

VS_FIXEDFILEINFO    *pFileInfo;

UINT                pLenFileInfo;

dwLen = GetFileVersionInfoSize("D:/firefox.exe", NULL); 

BYTE *test = new BYTE[dwLen];

GetFileVersionInfo("D:/firefox.exe", NULL, dwLen, test);

VerQueryValue(test, "\\StringFileInfo\\%04x%09x\\FileDescription", (LPVOID*)&stFileDescription, &pLenFileInfo);

delete[] test;

cout << stFileDescription;

Open in new window

0
I have  a MFC console application created using Visual Studio 2017,
Log.h file
class CLog
{
public:

	CLog();

	static	void Log(LPCTSTR str, BOOL bError = FALSE); 
	static	void Log(LPCTSTR str, BOOL bError, LPCTSTR szFileName);
	static void SetPathName(CString& strName);
	
private:
	static CString m_strLogPathName;
};

Open in new window


Log.cpp
#include <afxwin.h>
#include "Log.h"

using namespace std;

CLog::CLog()
{
	
}

void CLog::Log(LPCTSTR szMsg, BOOL bError)
{
}

void CLog::Log(LPCTSTR szMsg, BOOL bError, LPCTSTR szFileName)
{
}
void CLog::SetPathName(CString& strName)
{
	CLog::m_strLogPathName = strName;
}

Open in new window


The above code is giving the compilation error:

Error      LNK2001      unresolved external symbol "public: static class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > CLog::m_strLogPathName" (?m_strLogPathName@CLog@@2V?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@A)      TestH1      D:\Test\TestH1\TestH1\Log.obj      1      
Error      LNK1120      1 unresolved externals      TestH1      D:\Test\TestH1\Debug\TestH1.exe      1

Thanks for your help
0
I started with asking what the different is between "mode" and "flag", see: https://www.experts-exchange.com/questions/29122213/What-is-the-difference-between-mode-and-flag.html

However, I see that people are using different definitions for a flag. So it's better to start with the question: what is the definition of a flag? I'm not asking for general definitions, or your own definition, but specifically use the definitions in this post (and if necessary correct them and tell me what's wrong about the existing definition).

See: https://techterms.com/definition/flag

In computer science, a flag is a value that acts as a signal for a function or process. The value of the flag is used to determine the next step of a program. Flags are often binary flags, which contain a boolean value (true or false). However, not all flags are binary, meaning they can store a range of values.

Let's start with:

a flag is a value

So apparently, according to this definition, a flag IS a value. So a flag can not be seen as something that be two different values (two different states).

The next sentence confirms that:

Flags are often binary flags, which contain a boolean value (true or false).

Let's say we have c++ std::bitset, but it's about 1 bit. Firstable, it's important to be aware of the difference between:

1. setting the flag
2. setting the bitset

The bitset can be 1 or 0  (in this case because we have one …
0
Starting with Angular 5
LVL 12
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

When it's about "flags", I've noticed that different people have different ideas of what a flag is. Some people start to talk about "bit set" when it's about flags. I think the problem lies with the underlaying definitions. It looks like things are not well defined. So for this question, forget about your own ideas/definitions of what a bit set is, just follow the definitions in this post (and change them if necessary). Also forget about flags, this post is specifically about "bitset". First let's start with some "definitions":

See: http://www.cplusplus.com/reference/bitset/bitset/ (std::bitset)

A bitset stores bits (elements with only two possible values: 0 or 1, true or false, ...).

And see: http://www.cplusplus.com/reference/bitset/bitset/set/ (std::bitset::set)

all bits (1)      
bitset& set();
single bit (2)      
bitset& set (size_t pos, bool val = true);

(1) all bits
Sets (to one) all bits in the bitset.
(2) single bit
Sets val as the value for the bit at position pos.

I understand this. But now first let's start at the beginning and let's define a "bit". Let's define it like this:

A bit is an element of two possible binary values: either 0 or 1.

So let's see a bit as a box that contains a ball or a box that doesn't contain a ball. Now let's take a look at a bitset that represents the number 4:

 -----------------------
|0     | 0     |  1     |
|0*2^0 | 0*2^1 |  1*2^2 |
 -----------------------
3 boxes: 
Box 1: no ball
Box 2: no ball
Box 3: ball

Open in new window

0
I had a window on which i am drawing a bitmap , and am dragging the window basically the bitmap. My code is capturing the bitmap from one location and the problem is when i drag it the bitmap keeps changing to the bitmap to the place where my mouse is moving.  Suppose i have 2 images drawn on screen . when i start dragging from the place near to image 1 and keep on moving bitmap also changes, i am not getting it how is it changing , shouldn't bitmap should remain same ? Why is it changing if the position of my window is changing , i have checked the coordinates are same they are not changing which i have passed in BitBlit function

in Onpaint() i have used this code -
hBitmap = ::CreateCompatibleBitmap(m_panel_hdc, 600,600);
paint.BitBlt(100,100,585,600, window_dc,599,77,dwRop);
::SelectObject(m_drag_wnd_compatible_dc, hBmpOld);


OnMouseMove()
I am calling MoveWindow() API for moving the window.

And also when i try to move the window fastly with mouse the traces of bitmap of getting dragged are left behind and take time to be back in normal position.
Any help would be really appreciated.
0
I'm trying to set up a uncaught exception handler at process level in a
> vc++ program
> set_terminate() and set_unexpected()
> My program is multi-threaded.  I'm already able to set up my handlers in
> the main thread and catch all the exceptions thrown by the main thread.
> What I'm not able to do is to trap all the uncaught exceptions thrown by
> non-main threads.

Can you please give me sample program inside the Winmain() how to call the set_terminate() and set_unexpected()  functions and how to declare outside of the Winmain().
0
I'm trying to investigate a problem with resource files generated by Google Omaha. These resource files contain a place-holder token (%1!s!), which is substituted with branding details during the build process. There are numerous language resource files that contains string tables and this

Here is an example string: "%1!s! some arbitrary text"

Where %1!s! is a place-holder for some substitution text?

My question: is this place-holder substitution mechanism a standard part of the Windows resource file mechanism? If so, can someone please either explain how it works? Where does it get the text used to substitute the place holder? I'm assuming the place-holder works similar to place-holders in printf? If so, how does it know which text token to replace this with? If this is not a standard resource file mechanism, does anyone have a clue as to how Omaha does this during the build process?

Many thanks.

Note: I'm not looking for suggestions to use a different approach. This is how Omaha does it and I just need to understand how this works. Thank you.
0
Hello,
There are 2 COM interfaces whose implementation is proprietary

I need to create a COM object (either in C++ or C# com server) and invoke it to use their functions from a c# client console application

How should i approach the task?

Thank you
0
Hi Team,
I want to design the global try/catch block inside the winmain() function and my application already do have __try and __except blocks (SEH mechanism).
So i want to add global try/catch block for that it will help us to catch the unhandle exceptions.
Please find the below code and give your suggestion where can i add the global try/catch block inside the winmain(..).

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int showCmd)
{
    MSG msg = { 0 };

    __try
    {
        HACCEL      hAccel;
        WNDCLASSEX  wcl = { 0 };
        char        errorText[1024];

        g_hInst = hInstance;

        /* register main window class */
        if (!RegisterClassEx(&wcl))
            return TPG_GenMessageDialog(NULL, "Error registering main window class.",
            APP_TITLE " Win32 Error", MB_ICONSTOP, SS_MSGDLGTIMEOUT);
        /* read ini file */
        /* create main window  code*/
        /* show window - showCmd overrides saved state if not SW_SHOWNORMAL */

        hAccel = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDR_ACCELERATORS));  /* ignore error */

        /* start it up! */
        if (!Startup(errorText, sizeof errorText))
        {
            Log(mtIgnore, SS_NOMCPMSG, TPG_LOGLEVEL_ERROR, errorText);
            return TPG_GenMessageDialog(g_hWnd, errorText, APP_TITLE " Startup Error", MB_ICONSTOP,
                SS_MSGDLGTIMEOUT);
        }
        while (GetMessage(&msg, NULL, 0, 0) > 0)
        {
1
I have a code in C++ which needs to be converted into VBA.

//#include <Rcpp.h>
//#include <math.h>
//#include <iostream.h>

using namespace Rcpp;
double qnormal_x,qnormal_y,qnormal_z;
double expq(double q, double w){
if(q==1.0){
return(exp(w));
}
else{
return (expl(log(1.0+(1.0-q)*w)/(1.0-q)));
}
}
double lnq(double q, double w){
if(q==1.0){
return(log(w));
}
else{
return ((exp(log(w)*(1.0-q))-1.0)/(1.0-q));
}
}
void setseed_qnormal(double v0, double z0){
qnormal_x = sqrt(1-v0*v0);
qnormal_y = v0;
qnormal_z = z0;
}
double Q8(double w, double v){
return(8*w*v*(((16.0*w*w-24.0)*w*w+10.0)*w*w-1.0));
}
double P8(double w){
return((((128.0*w*w-256.0)*w*w+160.0)*w*w-32.0)*w*w+1.0);
}
double f(double z){
return(1.0-fabs(1.0-1.99999*z));
}
void qnormal(double q){
double qq;
qnormal_y = Q8(qnormal_x,qnormal_y);
qnormal_x = P8(qnormal_x);
qq = (q+1.0)/(3.0-q);
qnormal_z = f(expq(qq,-qnormal_z*qnormal_z*0.5));
qnormal_z = sqrt(-2.0*lnq(qq,qnormal_z));
}  

// [[Rcpp::export]]
NumericVector Chaotic(int n,double q,double v0, double z0){
  double eta;
  double xi;
  NumericVector ux(n);
setseed_qnormal(v0,z0);
for(int i=0;i<n;i++){
qnormal(q);
xi = qnormal_x*qnormal_z;
eta = qnormal_y*qnormal_z;
ux[i]= xi;
}
return ux;
}

Open in new window

0
I wish I could find simple example C++ code to read a JPG file from the disk and put it in the clipboard.
Windows, MFC, VS2017.
0
could you anyone explain how we will convert c++ code to PHP ?
0
Exploring ASP.NET Core: Fundamentals
LVL 12
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

Link to the problem:

The code works fine on my own system, but while submitting shows wrong answer?

 
   #include <stdio.h>
    void main()
    {
    	int t, n, count;
    	scanf("%d", &t);
    	while(t--)
    	{
    		count=0;
    		scanf("\n%d",&n);
    		while(n>0){
    		if(n%10==4)
    		{
    			count++;
    		}
    		n=n/10;
    	}
    	printf("\n%d", count);
    	}
    }

Open in new window

0
Hi All

I have a query regarding  memory related issue I am getting in one of my web service.
I have made a service using c# which is calling C++ third party dll. While running the service I am getting below error.

"Memory gates checking failed because the free memory is less than 1%."

After going through in deep, i found that there is some memory leak issue exist in the dll.
do we have any way by which-

1. we can release the used memory by c++ dll in c#?
2. Within service or using IIS, can we put a check by which how much free memory, service is using we will get to know and then and there can do the forceful recycle?

any idea will help.

Thanks
0
Hi I am having problems with a vector that I am populating each element from a structure but the elements seem to be getting partially over written Here is what I am drying to do
STRUCTURE
struct YUV_Buffer
{
	void *pCacheBuf;
	int frameID;
	int height;
	int width;
	YUV_Buffer() { pCacheBuf = NULL, frameID = 0, height = 0, width = 0; }
};

Open in new window

[/Constructors
        YUV_Buffer *nBuffer;
	vector<YUV_Buffer> mBuffer;

Open in new window

Implementing the vector array
Here I create a new instance of the structure from within a while loop each iteration of the loop a new video frame is passed to the structure and then added to the vector as a new element
                        YUV_Buffer *nBuffer = new YUV_Buffer();
			nBuffer->frameID = pmfxInSurface->Data.FrameOrder; // frame number
			nBuffer->width = pmfxInSurface->Info.CropW;                 // frame width
			nBuffer->height = pmfxInSurface->Info.CropH;                // frame height
                        nBuffer->pCacheBuf = pSysFrame;                                     // YUV video buffer
                        mBuffer.emplace_back(*nBuffer);                                      // add structure to vector array
                        SAFE_DELETE_ARRAY(nBuffer);                                            // delete structure

Open in new window

I then for testing that the data in the vector element is correct I do the following with OpenCV
each iteration of the while loop cnt is implemented by 1 and mBuffer[cnt].pCacheBuf) contains the video buffer data
                  cv::Mat picYV12 = cv::Mat(pmfxInSurface->Info.CropH + (pmfxInSurface->Info.CropH / 2), pmfxInSurface->Info.CropW, CV_8UC1, mBuffer[cnt].pCacheBuf);
		  cv::Mat picBGR;
		  cv::cvtColor(picYV12, picBGR, CV_YUV2RGBA_NV12);
		  cv::Mat test;
		  cv::cvtColor(picBGR, test, CV_BGRA2RGBA);
		  cv::imshow("MyVideo", test);
		  cv::waitKey(20);

Open in new window

This code works and OpenCV display the video frame in its own window perfectly my problem is I need to load all video frames into the vector array and be able to access each frame individually from the vector but what is happening is that the last element in the vector seems to be over writing all previous elements so I end up with 3000 elements in the vector all containing the last video frame buffer. It seems that its only the buffer array that is getting over written as the frame numbers are correctly assigned to each element.

I then need to call each frame from the vector in any order I wish, I have been trying to do it this way

Open in new window

0
I am trying to open a file dialog box but stumble to in to a problem.
And i al ready #include <commdlg.h>

C:\dev\test_menu/main.cpp:146: undefined reference to `GetOpenFileNameA@4'
collect2.exe: error: ld returned 1 exit status
The terminal process terminated with exit code: 1

#include <windows.h>
#include <stdio.h>
#include <commdlg.h>



void AddMenus(HWND);
void open_file(HWND);
HMENU hMenu;

int ID_Save;
int wp;


const char g_szClassName[] = "myWindowClass";

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, LPARAM wp)
{
    
    
    switch(msg)
    {
        case WM_COMMAND:
        
        switch(wParam)

        {
            case 2:
            MessageBeep(MB_OK);
            break;

            case 3:
            open_file(hwnd);
            break;
            


            case 5:
            SendMessage(hwnd, WM_CLOSE, 0, 0);
            break;


        }


        case WM_ACTIVATE:
            AddMenus(hwnd);
            break;
        case WM_CLOSE:
            DestroyWindow(hwnd);
        break;
        case WM_DESTROY:
            PostQuitMessage(0);
        break;
        default:
        return DefWindowProc(hwnd, msg, wParam, lParam);
    }
    
    
    return 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,  LPSTR lpCmdLine, int nCmdShow)
{
    WNDCLASSEX wc;
    HWND hwnd;
    MSG Msg;
   
    wc.cbSize        = sizeof(WNDCLASSEX);
    wc.style         = 0;
    wc.lpfnWndProc   = 

Open in new window

0
We would like to find a way to automatically convert an excel workbook into c++ code.
The following tool apparently does that (calc4web) however it generates a compiled .dll intead of C++ code.
We want to be able to reuse and enhance the c++ code.
Anyone used this before? Are there any other out of the box solution out there ?
If not, is there a way or a tool  to map the entire workbook so that we can follow it like a blue print and then convert it to c++
Any ideas or solutions would be very helpful
0
I create my tree using the code a bellow :
//Create my own Tree(Items + Sub Items)
BOOL CIntAccDlg::OnInitDialog()
{
      CDialogEx::OnInitDialog();
      HTREEITEM hMétrologie, hSurveillance, hHisOuverture, hHisDépassementTempérature, hHisMiseTerre, hLogResetsHis , hMetrologieLegale,hRelais, hCourbeDeCharge, hGlissProgrammé ,hHorodate, hFacturation, hStructureActive, hGlissPeriodique,hStructurePassivective, hJoursFériés, hCalendrierTarifaire, hInstantanée, hMetrologieNonLegale, hEnergie, hMoyenne,hMaximas,hContrat,hExursionTension
      , hCoupures,hCommunication, hCléAESGCM, hCléCrypAUTHGCM, hParPhyPortLocal, hHDLCPortLocal, hParPhyPortSerie, hParHDLCPortSerie, hImporter, hExporter, hImprimer;
      
      //Métrologie
      hMétrologie = m_treeCtrl.InsertItem(_T("Métrologie"), TVI_ROOT);
      hMetrologieLegale = m_treeCtrl.InsertItem(_T("Métrologie Légale"), hMétrologie);
      hMetrologieNonLegale = m_treeCtrl.InsertItem(_T("Métrologie Non Légale"), hMétrologie);
      //Métrologie légale
      hInstantanée = m_treeCtrl.InsertItem(_T("Instantanées "), hMetrologieLegale);
      hEnergie = m_treeCtrl.InsertItem(_T("Energies "), hMetrologieLegale);
      //Métrologie Non légale
      hMoyenne = m_treeCtrl.InsertItem(_T("Moyennes "), hMetrologieNonLegale);
      hMaximas = m_treeCtrl.InsertItem(_T("Maximas "), hMetrologieNonLegale);
      hContrat = m_treeCtrl.InsertItem(_T("Contrat "), hMetrologieNonLegale);
      hExursionTension = m_treeCtrl.InsertItem(_T("Excursion de tension "), hMetrologieNonLegale);
      //Relais
      hRelais= …
0

C++

57K

Solutions

24K

Contributors

C++ is an intermediate-level general-purpose programming language, not to be confused with C or C#. It was developed as a set of extensions to the C programming language to improve type-safety and add support for automatic resource management, object-orientation, generic programming, and exception handling, among other features.