473,796 Members | 2,669 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Effective Use of Low-Level C and C++

I am trying to learn more about how to effectively mix low-level C code
with C++. I am having trouble finding resources/papers/books that
aren't in one or the other camp exclusively.

Can anyone point me toward a good place to start? I want to understand
how to make decisions about the development environment, code structure
and planning, and any other issues that I'm not aware of that may be
important to know.

Thanks in advance!

Matt

Jul 19 '05 #1
5 5784
"Matt Priest" <ml******@micro n.com> wrote...
I am trying to learn more about how to effectively mix low-level C code
with C++. I am having trouble finding resources/papers/books that
aren't in one or the other camp exclusively.
Shouldn't that serve as a hint for you?
Can anyone point me toward a good place to start?
You should probably start with a decent C++ book.
I want to understand
how to make decisions about the development environment, code structure
and planning, and any other issues that I'm not aware of that may be
important to know.


This has nothing to do with either language. Visit comp.software-eng.

Victor
Jul 19 '05 #2
Victor Bazarov wrote:
"Matt Priest" <ml******@micro n.com> wrote...
I am trying to learn more about how to effectively mix low-level C code
with C++. I am having trouble finding resources/papers/books that
aren't in one or the other camp exclusively.

Shouldn't that serve as a hint for you?

Can anyone point me toward a good place to start?

You should probably start with a decent C++ book.

I want to understand
how to make decisions about the development environment, code structure
and planning, and any other issues that I'm not aware of that may be
important to know.

This has nothing to do with either language. Visit comp.software-eng.


Victor's comment is 100% right but that is not the perception I hear
from embedded and low level engineers.

There are 2 factors that confound the issue for C++. The first is
complexity. C++ is far more complex than C and while the run-time
implications of C++ are miniscule and often far more favorable than C,
however the "programmer insecurity" factor kicks in and most engineers
don't leave themselves the time luxury to learn C++. The second factor
is the STL. The STL has some very cool features, however it is not
effective for the embedded paradigm where space and resource utilization
is a major issue. In some cases, real-time (also regulatory) contraints
preclude the use of the STL.

Every discussion I have had with an anti-C++ embedded programmer, I have
been able to give constructive discussion about how moderm compilers and
C++ have an excellent synergy and got them thinking about the
possibilities (or I just bored them to submission, I have yet to find out).

There are a couple of meanings to "low level" - 1. kernel and driver
code and 2. embedded code. The constraints are very similar.
Performance and resource utilization constraints are more significant
that application code. Also, most low level code needs to run for much
longer periods and the consequences of code failure is far more
significant. (e.g. my cell phone crashes ... it's true ...).

Significant factors for embedded apps:

1. code size (limited ROM space)
2. stability (*must* never crash)
3. real-time (if a coms interrupt is not serviced, data is lost)

These are more design issues than language issues. However C++ does
have some very nice tools to be able to achieve these 3 that C does not.
C++ templates allow you to create very efficient "policy" objects that
allow you to create very stable and much easier to maintain code.
Inlining small methods increses performance and may actually reduce code
size.

OK - I'm done with the ranting ... for now.


Jul 19 '05 #3
"Matt Priest" <ml******@micro n.com> wrote in message
news:3F******** *******@micron. com...
I am trying to learn more about how to effectively mix low-level C code with C++. I am having trouble finding resources/papers/books that
aren't in one or the other camp exclusively.

Can anyone point me toward a good place to start?


Maybe you'll find this article an interesting read:
http://www.objectmentor.com/resource...tillUsingC.pdf

--
Peter van Merkerk
peter.van.merke rk(at)dse.nl
Jul 19 '05 #4
Matt Priest wrote:
I am trying to learn more about how to effectively mix low-level C code
with C++. I am having trouble finding resources/papers/books that
aren't in one or the other camp exclusively.

Can anyone point me toward a good place to start? I want to understand
how to make decisions about the development environment, code structure
and planning, and any other issues that I'm not aware of that may be
important to know.


Scott Meyers' "More Effective C++", Item #34, is a good starting point.

--
----- stephan beal
Registered Linux User #71917 http://counter.li.org
I speak for myself, not my employer. Contents may
be hot. Slippery when wet. Reading disclaimers makes
you go blind. Writing them is worse. You have been Warned.

Jul 19 '05 #5
Matt Priest wrote:
I am trying to learn more about how to effectively mix low-level C code
with C++. I am having trouble finding resources/papers/books that
aren't in one or the other camp exclusively.
I really don't understand how the "low-level" C code differs from
the "low-level" C++ code, unless we have a different understanding
of "low-level code".

My understanding of "low-level" language code is the statements that
allow bit manipulation. Both languages have the same capabilities
for bit manipulation.

My 20+ years of experience with embedded systems has shown me that
both C and C++ can be used to access hardware components directly.
In systems where the components are memory mapped, deferencing a
pointer will access the hardware component.

Can anyone point me toward a good place to start?
Start doing what? Programming an embedded system? Accessing hardware
components? Bit manipulations? Writing your operating system?

I want to understand
how to make decisions about the development environment, code structure
and planning, and any other issues that I'm not aware of that may be
important to know.
I believe most of your issues can be answered by the folks at
news:comp.arch. embedded.

Thanks in advance!

Matt

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.l earn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book

Jul 19 '05 #6

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

Similar topics

2
2289
by: Evelyn Pabón | last post by:
Hi I built a database application and I have a field which is for the Close Date. But I need to create an effective date that it will come out automatically. The Effective Date should be 6 months after the Close Date. How can I do this? Any help I would really appreciate it. Thanks,
5
11614
by: Ross Presser | last post by:
As our customers demand that we tighten our IT security in the company, I've been asked to prepare a report quarterly showing, for each user in Active directory, what his effective permissions are for every table in every database that he has permission for on our SQL Server 2000 server. I searched a bit for a tool to do this, but all I found was the PERMISSIONS() function for showing effective permissions of the current user. Is there...
19
5887
by: Lorenzo J. Lucchini | last post by:
My code contains this declaration: : typedef union { : word Word; : struct { : byte Low; : byte High; : } Bytes; : } reg;
26
10885
by: Bruno Jouhier [MVP] | last post by:
I'm currently experiencing a strange phenomenon: At my Office, Visual Studio takes a very long time to compile our solution (more than 1 minute for the first project). At home, Visual Studio compiles the same solution much faster (about 10 seconds for the first project). My home computer is only marginally faster than the one I have at the office (P4 2.53 vs. P4 2.4, same amount of RAM). On the slow machine, the CPU usage is very low,...
2
1333
by: Harry | last post by:
Hi, Quick question regarding dropdownlists. On one page I have 10 asp:dropdownlists. The user selects an option from a dropdown list and then it updates an asp:label with the relevant text. The user must select an option from each dropdown list. All the dropdownlists are to be populated from a SQL database.
44
3884
by: Josh Mcfarlane | last post by:
Just out of curiosity: When would using std::list be more efficient / effective than using other containers such as vector, deque, etc? As far as I'm aware, list doesn't appear to be specialized for anything. Thanks, Josh McFarlane
3
1179
by: creator_bob | last post by:
I decided to post here after a little incident where I got an effective memory leak that was immune from garbage collection. I created a simple binary tree, no balancing or deleting. Only two functions from the root--update (add if missing), and read. The problem was the update had a bug and after updating, it would always then add as though the item were missing. This caused the tree to grow unbounded, but from all outward...
15
5935
by: Peter | last post by:
I right now reading this book. And he is iterating some points I'm following since 1996, e.g. exception safety. But e.g. he is missing one of the major exception safety guidelines, which is Allocate only a single resource inside a constructor body (deallocate in the matching destructor body). Chain such classes into base-class/member-class relationships. This way you are able to exploit the code generation features of the
2
4784
by: dunleav1 | last post by:
I have a many row and many column table that is in a 16K page size. I have four indexes on the table. I am running row compression on the table. The table does not have a primary key. The table does not have a clustered index. I ran a reorg on the table and the indexes. I ran runstats on the table and the indexes after the reorg. Three indexes on the table have an index cluster ratios of 99,99,100 respectively. The fourth index has a...
1
1936
by: mahesh.kanakaraj | last post by:
Hi All, I have a confusion in finding the 'effective content' of a complex type definition in a XML Schema. I shall give you an example situation to clearly explain my problem. Let's have an element declaration as follows:
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9525
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10221
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10169
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9050
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5569
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.