flynnwallace
01-16-2001, 01:08 AM
I have seen programs in which a mixture of C and C++ code is used. Is this good programming practice or not.
Flynn
Flynn
|
Click to See Complete Forum and Search --> : is it ok to mix c and c++ flynnwallace 01-16-2001, 01:08 AM I have seen programs in which a mixture of C and C++ code is used. Is this good programming practice or not. Flynn Stuka 01-16-2001, 01:21 AM What do you mean by "a mix of C and C++ code" exactly? There are some combinations that are bad, such as the iostream stuff (cin, cout) and printf/scanf, and of course new/delete don't mix well with malloc/free...but I guess it depends on what yer mixin'... Strike 01-16-2001, 02:41 AM You can mix all you want. That's the way C++ was designed - to be backwards compatible. You can mix the input/output and memory allocation too, if you want to (but don't). Heck, I first learned a mix of them both. But, generally, if you are going to do heavy OOP, stick with pure C++ as it will make things simpler. andy4us1 01-16-2001, 02:57 AM If you talking about combinations of *.c and *.cpp source files, then get ready to say hello to name mangling and mr "extern 'c'". Otherwise if your talking about using C functions and C++ classes , then given the right circumstances this can lead to much better class design. Horses for courses really, Andy flynnwallace 01-16-2001, 01:03 PM Thanks for the info guys. You all answered my questions. Flynn justlinux.com
Copyright Internet.com Inc. All Rights Reserved. |