473,378 Members | 1,390 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Reverting to C in C++ Code

Hi, all,

I'm finding that in my new project I have developers that have been
developing in C++ for many years but they default to C code in most places.
As such, our code is C++ by compiler, but tends to be C by design and
appearance. As examples, they're used to using character prefixes for
library function and variable names instead of namespaces, favoring *printf
to streams and stringstreams, avoiding exceptions in favor of overloading
return values, and avoid the STL in favor arrays, character buffers, and
hand-rolled containers.

Most of the reasons for which I have chosen the C++ path in these decisions
lie in my own comfort level with the language. There are some clear
benefits of choosing C++ over C for some of these decisions (STL reliability
and robustness over char * comes to mind) but some of my choices seem to be
more about personal preference than correctness (using namespaces instead of
prefixes for library functions/variables).

I'd like to educate myself on the pros and cons of each of these and other
C/C++ decisions. I do have several books on C++ but none really attempt an
objective analysis of each of these features. Many rely on the notion of
"this is how you do it in C++". Unfortunately, that argument doesn't carry
weight with my coworkers.

Can anyone recommend a good source for this information? Books are better
than web pages, but at this point I'll take anything I can get.

Thanks!
Scott

--
Remove .nospam from my e-mail address to mail me.

http://www.e-scott.net
Jul 23 '05 #1
4 1036

"Scott Brady Drummonds" <sc**********************@intel.com> wrote in
message news:ct**********@news01.intel.com...
Hi, all,

I'm finding that in my new project I have developers that have been
developing in C++ for many years but they default to C code in most places. As such, our code is C++ by compiler, but tends to be C by design and
appearance. As examples, they're used to using character prefixes for
library function and variable names instead of namespaces, favoring *printf to streams and stringstreams, avoiding exceptions in favor of overloading
return values, and avoid the STL in favor arrays, character buffers, and
hand-rolled containers.

Most of the reasons for which I have chosen the C++ path in these decisions lie in my own comfort level with the language. There are some clear
benefits of choosing C++ over C for some of these decisions (STL reliability and robustness over char * comes to mind) but some of my choices seem to be more about personal preference than correctness (using namespaces instead of prefixes for library functions/variables).

I'd like to educate myself on the pros and cons of each of these and other
C/C++ decisions. I do have several books on C++ but none really attempt an objective analysis of each of these features. Many rely on the notion of
"this is how you do it in C++". Unfortunately, that argument doesn't carry weight with my coworkers.

Can anyone recommend a good source for this information? Books are better
than web pages, but at this point I'll take anything I can get.


Have you read Stroustrup's "Design and Evolution of C++"?
Also you might find interesting Lippman's "Inside the C++ Object Model".

-Mike
Jul 23 '05 #2
I guess some of the issues you are mentioning are issues with
using C++. The more important thing is to make sure you have an
object oriented design.

When transition from C to C++, the difficult part is the transition
from procedural design to object oriented design.

The following articles might help:
http://www.eventhelix.com/RealtimeMa...esign_tips.htm
http://www.eventhelix.com/RealtimeMa...ign_tips_2.htm

Deepa
--
http://www.EventHelix.com/EventStudio
EventStudio 2.5 - Generate Sequence diagrams from a simple declarative
language

Jul 23 '05 #3
EventHelix.com wrote:
I guess some of the issues you are mentioning are issues with
using C++. The more important thing is to make sure you have an
object oriented design.

When transition from C to C++, the difficult part is the transition
from procedural design to object oriented design.
Who says that C programmers (programs) aren't object oriented?
Who says that a C++ programmer (program) must be object oriented?

Object Oriented Programming in C is just as good an idea as
Object Oriented Programming in C++.
The following articles might help:
http://www.eventhelix.com/RealtimeMa...esign_tips.htm
http://www.eventhelix.com/RealtimeMa...ign_tips_2.htm

Jul 23 '05 #4

E. Robert Tisdale wrote:
Who says that C programmers (programs) aren't object oriented?
Who says that a C++ programmer (program) must be object oriented?

Object Oriented Programming in C is just as good an idea as
Object Oriented Programming in C++.


Having written OO programs in both C and C++, let me tell you
that writing them in C leads to poorly readable C code.

E.g. your average C coder will not recognize

*(obj->vtable[obj_foo])(1)
or
SendMessage(obj, obj_foo, (void*)1 );
or
OOCALL( obj, foo, 1 ); /* nasty macro alert */

whereas your average C++ coder will understand
obj->foo(1);

Regards,
Michiel Salters

Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

51
by: Mudge | last post by:
Please, someone, tell me why OO in PHP is better than procedural.
9
by: bigoxygen | last post by:
Hi. I'm using a 3 tier FrontController Design for my web application right now. The problem is that I'm finding to have to duplicate a lot of code for similar functions; for example, listing...
31
by: Raymond Hettinger | last post by:
Based on your extensive feedback, PEP 322 has been completely revised. The response was strongly positive, but almost everyone preferred having a function instead of multiple object methods. The...
4
by: jason | last post by:
Hello. Newbie on SQL and suffering through this. I have two tables created as such: drop table table1; go drop table table2; go
0
by: DBQueen | last post by:
I am developing an application for a Pathology Lab. There are Batches (BatchID) which contain multiple Samples (SampleID), and there can be multiple tests run from the same Sample, thus there can...
2
by: ross kerr | last post by:
Hi all, I have a control that extends the ComboBox object. It updates the selected item based on what the user enters in the text area. In the OnLeave event of the combobox, the selected...
0
by: Dave | last post by:
Greetings, I am using a tabstrip in a user control (ascx) in a web application (aspx) that is used to navigate between the different aspx pages. Whenever I click on one of them, the...
4
by: mark.norgate | last post by:
Why oh why does my <asp:labelrevert to its initial value, having been changed programmatically, when I click a button in a user control I have added dynamically to the page? It's EnableViewState is...
3
LBryant
by: LBryant | last post by:
First of all, I want to say how thrilled was to find this forum and how much I value the expertise here. Now, here's my quandry. I have a form bound to a query that pulls a single record from a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.