Will standard C++ code always be portable? |
No. Parts of the language are specifically defined as implementation dependent (such as the size of int and long). Other things specifically create undefined behavior (such as reading past the end of an array). Perhaps the hardest part is that you can write code that depends on the implementation without you even realizing it.
This is why the term "porting code" exists. Sometimes your code works fine on one Processor/OS and fails on another. The reason is that you have some dependency on the first Processor/OS.
If you're talking about, say, a windows program that runs on one system and whether it will run on anther windows system, chances are very good that it will run, but you can still create unexpected dependencies that cause the code to fail when windows is upgraded or if someone has a configuration that's different from what you expect. I'll give a personal example: my "My Documents" folder is D:\dmh. This is different from the default of C:\WINDOWS\Dave. Many programs assume that you haven't moved "My Documents."
Will something compiled on one system to be very efficient on that system be very very inefficient on some other systems? |
That's very unlikely.
Is that what installers do? |
Installing a program, particularly a windows program, involves more than just copying files to the hard disk. There may be registry entries that are required, DLLs that have to be installed, shortcuts to put on the desktop, and you need to provide a way to uninstall the program too. The installer does all of this. But if the program was written in C++ then the installer isn't likely to recompile anything.
Any reading material you can suggest for writing an installer? |
Just this: don't do it. :). Find a program that will create the installer for you.
Also is the concept of pointers a C++ specific thing or do other languages also have this? |
As someone else mentioned, Pascal has it too. I'm not sure about other languages. Java uses references for everything.
An interesting aside: the more unique operation in C++ is
&
(address of). This can be used to greatly simplify some algorithms like inserting into a sorted linked list. But since most languages don't support it, most algorithm books don't show you how to do it. See for example my reply here:
http://www.cplusplus.com/forum/beginner/210154/
Is compiled always more efficient than interpreted? |
Hmm. Probably, although some interpreted languages do "just in time compilation" where they compile bits of the code and keep it around in case you need it later. Since lots of code involves loops this can greatly speed up the interpreted code.