Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP versus C++
Message
From
28/10/2003 21:51:47
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00842594
Message ID:
00843895
Views:
18
>[snip]
>>If I'm all wrong here, some expert jump in and tell me so, but my understanding is that C, being the base level would be the fastest. Most operating system are written in C. Almost all functionality in C is held in the C libraries. For example, if I wanted to print "Hello World" in C, I would call the print library passing it the string "Hello World". C++ is written in C. It provides the classes
>[snip]
>
>As far as I know, printing 'Hello world' with C is slower than printing it in C++. I think your idea that C++ is written in C is wrong. Maybe portions are written in C, but other portions are likely written in assembler and use processor specific features that C isn't allowed to use because of the C-standard.

Hi, Peter, Leland (Jim, also).

Just a few issues from an ex-Asm/C/C++ developer (I was so bad at them that I quited and got into Fox): 8-)

In the best recursive tradition, C compilers are usually written in C, while C++ compilers are usually written in C++. In both cases, you can include inline code (assembler code snippets), so it is always actually a mix.

As someone already mentioned in this thread, C++ is just a superset of C. C is not at all intrinsically faster than C++, because C is "inside" C++. Indeed, you can take any C program and compile in C++ with no "theoretical" problems (you can always get caught in some implementation detail).

What the compiler optimizer does in this cases is something quite difficult to do in higher level languages. Clever tricks as putting a counter for a loop into a Register instead of using a memory location (thus speeding up the loop because less memory access is needed), and things like that. Veeeery low level things. There is no magic. The compiler doesn't affect the code written, but how it is finally implemented in machine language.

This is one of the great things about .NET. The languages compilers are quiete efficient at generating optimized IL, and then, the .NET framework is very clever to compile this to machine language. The result is fast execution, but processor portability (plattform portability is also intended, but not yet fully supported).

My two pennys,
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform