Forumite

Reply To: C++ Programming

#62233
Participant
Ed P
@edps
Forumite Points: 16,575

Based on my old C experience you really need to crack pointers and addresses as they underpin arrays, strings etc, but probably as important is the need to correctly instantiate and range check anything you use otherwise you finish up with pointers that point at thin air and null addresses.

Once you crack that then comes the real pain of making sure that you have already set aside memory for these objects (malloc etc.), and of course freeing it (garbage collection). This is the area where you can generate really unsafe programs e.g. memory overflow, use after free, corrupted double pointers,  etc.

Just when you think you have cracked it all comes the problem of error trapping i/o. This becomes a very hard slog and only a very few programmers manage to write large completely ‘safe’ programs or routines. Bad programs can result in users blaming the OS for any security lapses (think of the ordure that Flash caused for years) and this is really why M$ pushed C# (though to be fair there are competitive ‘safe’ programming languages that are also a step or two away from the machine code that compiled C++ produces. e.g. Ruby, Python etc).