Board index » cppbuilder » General question about C and C++
Warren O. Merrill
![]() CBuilder Developer |
General question about C and C++2008-04-05 04:24:40 AM cppbuilder1 I have a large base of code (2.5 million lines) currently written in some other languages. Recently I started thinking that it might be useful to have a few chunks of that code written in C or C++. It would also improve my skills by translating some of it over to a new language. My only experience with C or C++ is just a few brief (and I do mean brief) times and that was quite a while ago. I'm guessing maybe a total of slightly less than 1,000 lines total that I've ever done and as I said it was quite some time ago now. Since I've been out of it for a long time I just wondering about some advice. I'm using BDS 2006 for the Pascal code I'm using and so I see that I have C++ Builder available to use in that same install. I'm considering the following issues: 1) The code has no interface issues to deal with. No GUI at all this is just good old callable routines that do stuff. You know the type, a couple of string params and a couple of integer params and it cranks and maybe creates some file or returns some string or value. None of this initially would be object oriented at all. 2) I want this to end up as a dll so I can call this from any of the other languages that I'm working with (Delphi Pascal, Ada, Modula-2). I want ease of use as far as connecting to this dll and passing parameters so no weird param types. Just the usual pushing numbers or for strings pushing the pointer and the size. I just mention this so you won't be thinking I'm trying to pass objects of some type, this is just simple parameters. 3) I want maximum portability of the code so in case I want to use a different compiler I can. Now to the question. My main question is would I code this as C code or as C++ code? I'm really out of the loop as far as knowing why I would use one over the other for this basic type code? I guess I'm just wondering if the C/C++ community out there has an opinion about why I would code it one way or the other. I tried playing a little bit with getting a project started and set up using C++ builder and it seemed that everything wanted to default to C++ ways of doing stuff. |