lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Mar 17, 2011, at 8:46 PM, David Favro wrote:

> Assembler might make sense, but using C rather than C++ for "bottlenecks"
> makes no sense since C++ is (essentially) a superset of C, i.e. any C
> program is itself (almost) a C++ program, and typically if C code is
> compiled with a C++ compiler rather than a C compiler (with the same
> code-generation/optimization back-end, e.g. cfront+cc vs. cc alone, or g++
> vs. gcc) will generate essentially the same (or, more often, exactly the
> same) object code, modulo symbols.  This was, in fact, one of the design
> goals of the language.

It's a lot easier to write things in C++ that behave unpredictably from a performance standpoint. For example, a = b in C++ can generate a huge amount of work, memory allocation, etc. In C, you would have to write copy_my_huge_structure_to_from( a, b ).

But I don't think that sort of concern really comes into play much at Microsoft. They would opt for the clarity of C++ (for some definition of "clarity").

The other issue on C++ that might have more weight is that C++ is a lot more sensitive to what version of the runtime library you are using whereas C involves little or no runtime library.