Well, it is also not completely true.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
Because it was not meant to be. It was merely a rant, or joke.
Most parts of the modern OSes is made in C and C++
Most part comes from C, that contains Assembly in __asm or similar. C++ is just used to create most APIs, because you can provide a simple abstraction there. You can provide underlying implementation of the system and services, then you leave it in the hands of programmers.
Of course drivers need to be fast, but what a driver is merely a program in the forest of services running. Tree (program) can be a class, a forest is abstraction, and... You cannot do that easily in C — that is why we have demons in Linux and you can write in in any definition, there is nothing to implement, nothing to inherit and nothing to worry about.
Move a bit ahead, enter the realm of C++, Qt for instance, you need to write classes as inherited ones and then you can compile that across. Qt is used for driver development.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
But the interpreter the VB Net code will be running on will be written in C or C++ because to run on actual hardware you have to run the instruction set that hardware exposes. You can only do that in a compiled language.
Because not everyone is programming desktop GUI apps, and not everyone hates OOP.
C++ provides an object-oriented programming model for C environments. C is Assembly language with a better syntax. So, it means you can do more of hardware programming easily, registers are available etc. C++ was created by Bjarne to include "classes", because he had experience in Simula, which was object-oriented.
C was not, so C++ was created to support that, C++ was called, "C with Classes". If you need hardware control and are only an OOP geek, then you use C++, otherwise you use C.
Despite my answer, this question is childish and immature. If you need to know if a language is needed to be learnt of if you should use it, know its history! That will answer all of your questions. Just a friendly reminder, when I started to learn how to program in 2011, I heard C++ was fading away, Java is future, I also heard Windows Forms will die soon, and WPF is future. None of that happens and these news are caused by some idiots in computer science who have no idea what they are saying.
The creator of C++, Bjarne Stroustrup, has acknowledged that Simula 67 was the greatest influence on him to develop C++, to bring the kind of productivity enhancements offered by Simula to the raw computational speed offered by lower level languages like BCPL.
Because C is the corner stone language in computing. It is the language of OSs, space ships, embedded, etc. C++ extends that power scales it, and is a true engineers language.
C# (Java) and other interpreted languages have their uses, principally where you want to limit the power of the language for security reasons, or to work at highly extrapolated levels a long way from the hardware.
As noted by others for drivers and embedded systems. It is a mature language that works well with hardware with less interpretation.
One reason many people left C++ was they hate pointers, but as those other languages mature, they too employ pointers, so in the end we are now seeing a revival of C++.
I have a complicated xml that i need to read into variables it looks like below example. I need to put each of those into attributes into a database then recreate the same xml with change attribute values from my database.
<wmifileheader fileid="123456.20060410.001714.909268" filetype="FOR" version="4.0.0">
I am receiving a date structure in "24-9-2016 13:30" format. Now I want to convert time value to specific timezone, I am doing calculations and have number of hours to add or substract.
So I don't know: how can I initialize tm struct with the date value I have? how to add or substract hours in tc struct variable to get required date?
my intention is
Date received "24-9-2016 13:30" and 5 Hours to add so final Date: "24-9-2016 18:30"
//Temporarily init time to local
struct tm *initStruct = localtime(&tempTime);//initialize it with local time
//now modify it to user defined date
initStruct ->tm_year = 2016;
initStruct->tm_mon = 9;
initStruct->tm_hour = 13;
//Not sure how can I subtract or add hours in this struc to get desired date value
I am not sure what this has to do with Managed C++. However, the time, _time32, _time64[^] function describes the content of a time_t value, which you can easily initialise with a user defined time. I have not come across a date_t type, where is it defined?
Since all those fields are integers you can add, subtract or replace any of them. You should check that the values are valid in terms of the calendar, although the mktime, _mktime32, _mktime64[^] functions will attempt to normalise a tm structure into a valid time. There are many other useful functions, and you should study the documentation to see which ones will help you.
Yes, all these are integers, so I can perform addition or subtraction, but it is not handled well in below cases-
if hours are added
Like 4.5 then 13 hours should become 18:30
Or more than 24 then date should modify
In above cases I will need to add additional code depending on hours value, which is bad, isn't there any system method which will modify entire structure depending on the value assigned
If you want to add partial hours, days etc. Then use mktime (as I advised in my previous comment) to convert your tm structure into a time_t value. you can then just add or subtract the number of seconds in your time increment.
Last Visit: 31-Dec-99 18:00 Last Update: 9-Aug-22 18:31