Can someone show me a good example of combining C and C++ to write a program that would be easier to write than if you were using any of the two languages alone?
Printable View
Can someone show me a good example of combining C and C++ to write a program that would be easier to write than if you were using any of the two languages alone?
Well, considering the fact that C++ has all of the abilities of C, I don't see the point. (The opposite is supposedly true also, though it's harder to implement the features of C++ in C.)Quote:
Originally posted by volk
Can someone show me a good example of combining C and C++ to write a program that would be easier to write than if you were using any of the two languages alone?
Quzah.
>>The opposite is supposedly true also
How would you implement templates in C?
Sheesh, it sounds like C++ is superior C. Why am wasting my time learning C when I could be learning C++ (no wonder the tutorials on this site are for C++).
Is it possible to at least combine C++ and Java or something?
C++ is a superset of C, you're not wasting your time learning C, it will give you a base when you'll start to learn C++. Most of the things your learned in C will help you in C++.
And why you want to combine Java and C++? well, one is compiled the other is interpreted (some times compiled, using JIT), but I don't see why you need to combine them, and when you write combine, what you mean? write one program in those 2 languages together?
Yes, that's what I mean by combine. I'm sure all the programming languages out there have there advantages and disadvantages, and I just thought the combination of multiple programming languages would be a great way to offset a programming language's disadvantages.Quote:
...and when you write combine, what [do] you mean? write one program in those 2 languages together?
Aren't there any programs at all that exemplify what I'm saying?
Well, writing in the same source code, like asm and c/c++ that you can use inline assembler with asm("//asm code here"); I never saw something like this with Java.
But I saw a lot of app that were built with various programming languages, like the GUI of the program were made in Java, while the core and function were made in C/C++.
>How would you implement templates in C?
With great care. You could simulate the effect of templates with some creative preprocessing that I'm not in the mood to attempt right now. Maybe later. :D
>Sheesh, it sounds like C++ is superior C.
No, just different. No language is superior, they are all designed with different goals in mind and that effects the outcome as well as the application field.
> I just thought the combination of multiple programming languages would be a great way to offset a programming language's disadvantages.
Possibly, but it's more likely that the glue that holds the two languages together would add more complexity to the meta-language than either of the component languages alone would have. Of course it is possible and has been done before, but at the source code level it's generally a bad idea and hard to create as well as maintain.
-Prelude