Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
GNU Coding Standards said:When you want to use a language that gets compiled and runs at high speed, the best language to use is C. Using another language is like using a non-standard feature: it will cause trouble for users. Even if GCC supports the other language, users may find it inconvenient to have to install the compiler for that other language in order to build your program. For example, if you write your program in C++, people will have to install the GNU C++ compiler in order to compile your program.
C has one other advantage over C++ and other compiled languages: more people know C, so more people will find it easy to read and modify the program if it is written in C.
So in general it is much better to use C, rather than the comparable alternatives.
My sentiment exactly!.Then only once you're finished, you measure the performance and optimize areas where you've proven there to be an unacceptable level of efficency...
Yep, that's pretty much what I was getting at, but better put. If I take a piece of number-crunching code I've written in ANSI C and compile it instead with a C++ compiler, the performance difference will likely be negligible.Salem said:I don't think there is anything inherently poor about C++ performance (plenty of C++ code looks pretty zippy to me), but there is more scope for programmers to abuse the features on offer. What might be harder to do however is figuring out which C++ constructs are more expensive than others. In addition, the degree of performance difference across several compilers for the same construct could also vary quite widely.
int f(int a, int b, int c)
{
/* I do stuff with a, b and c */
}
int f(struct threeint *T)
{
/* Now instead I use T->a, T->b and T->c */
}
int f(struct threeint T) { ... }
int f(int* pa, int* pb, int* pc) { ... }
Oops, well, not surprising, since I really don't use C++ at all; I was using C syntax, and just quoting it as an example of how something like a struct, or an object, which can create easier notation and more elegant code, can have a negative effect on performance.ArkM said:(pass by value, as in the 1st function)
int f(alienspaceship *T) { ... }