Why? I mean did you loose the sourcecode or something? Otherwise you add another "something" and recompile it/run it.
Sorry, I meant "two instances in the same program". As, well, if you had a nice system of viewports and menus, then suddenly you have to adopt 3d monitors and Oculus Rift. Thus, you need two such systems, one for each eye and... oopsie. You'll have to remake the system into a class anyway, moving all global variables into fields and so on.
For a real example, I deliberately made chepersy a monolitic procedural mess. I'm very sorry now, as it doesn't allow for parallel operations in different threads. Remaking it into a class would require a lot of effort, too
A better real example, the input/window manager system in my game engine is a class. The Windows and Linux versions have different implementations descending from the same abstract base class. If I want to switch the Linux version from the ages old X-windowing system to, say, GTK+, I only have to add an implementation. Then it could even be switched on the program startup, depending on the settings. The same as it already does choose between DirectSound and OpenAL in the windows version. Classes too.
Modularity is such a great thing
I've never needed the extreme compactness nor speed of assembly or machine code. I cannot argue though that if you can code in it, it is by far the single best approach to a one off program
Not anymore. Todays CPUs are so complex (with layers, like in onions and ogres) that a decent compiler will *always* outperform a human.
I only use assembly language for specific tricks the compiler wouldn't understand. Like bit scan, or the fastest hardware timer available:
- Code: Select all
pushf
rdtsc
mov dword[Result], eax
mov dword[Result + 4], edx
popf