473,663 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CRT, Member Initialisation, static data, constant data, global objects

Tim
Please advise if you can.

Presumably initialisation of members in member initialisation lists is
perfomed by 'C' run-time startup. If the CRT was never started-up would
those members be garbage? Which of these fundamental language support
features could I expect to be absent (and anything else I might have
missed):

static data zeroing
global data zeroing

static data initialisation
constant data initialisation
global data initialisation
scoped satic data initialisation

static object construction
global object construction
scoped object construction

initialisation of members in member lists

new
delete
I'm having to fix an embedded PowerPC-based platform that I never worked on
and which has many thousands of lines of lamentable source; the only
function it calls from the assembly startup code is Init_CPP_Constr uctors
which, in-turn, calls each constructor in an array of constructors in a
'ctors' segment. I see no other CRT startup calls; in fact, I don't even
think this is CRT code; I think it's simply a hand-made 'bare-bones'
startup. If so, would I be correct in assuming that a hefty chunk of support
features will be absent? The firmware actually uses enums, not constant data
and only has a few static variables and global data. It also has one class
with members initialised in the list; the rest have members initialised in
the constructors. My assumption is that there are quite a few oppertunuties
for disaster here; would you agree?

If anyone's wondering why I don't simply have a look using a debugger...
there isn't one... nor any trace port; I't a question of downloading to
flash and using a red LED or a green LED for diagnostic 'messages'. However,
I've just got home so even that isn't an option right now. Your help will be
greatly appreciated; your sympathy more than welcome :-)

Regards
Tim
Jul 22 '05 #1
2 2228
Tim wrote:
Please advise if you can.

Presumably initialisation of members in member initialisation lists is
perfomed by 'C' run-time startup. If the CRT was never started-up would
those members be garbage? Depends on the hardware. Some memory initializes itself to zeros, some
to all ones. But then if the memory was used before this program was
executed, yes, there would be garbage (unknown, random values).
Which of these fundamental language support
features could I expect to be absent (and anything else I might have
missed):

static data zeroing
global data zeroing

static data initialisation
constant data initialisation
global data initialisation
scoped satic data initialisation

static object construction
global object construction
scoped object construction

initialisation of members in member lists All of the above would not happen if the C++ Run-Time Library
was not invoked (CRTL or CRT). The above takes executable code
to perform. Somehow, the variables must be initialized.

new
delete As for these, depends on the implementation.
I'm having to fix an embedded PowerPC-based platform that I never worked on
and which has many thousands of lines of lamentable source; the only
function it calls from the assembly startup code is Init_CPP_Constr uctors
which, in-turn, calls each constructor in an array of constructors in a
'ctors' segment. I see no other CRT startup calls; in fact, I don't even
think this is CRT code; I think it's simply a hand-made 'bare-bones'
startup. Sounds more like a hook that a compiler manuf. provides for more
flexibility. Sounds familiar, perhaps Metware High C/C++ compiler?
You may also want to post to news:comp.arch. embedded.

If so, would I be correct in assuming that a hefty chunk of support
features will be absent? Read your compiler documentation. You haven't specified which compiler
you are using.

The firmware actually uses enums, not constant data
and only has a few static variables and global data. It also has one class
with members initialised in the list; the rest have members initialised in
the constructors. My assumption is that there are quite a few oppertunuties
for disaster here; would you agree? Can't agree or disagree since you haven't posted the code.

If anyone's wondering why I don't simply have a look using a debugger...
there isn't one... nor any trace port; I't a question of downloading to
flash and using a red LED or a green LED for diagnostic 'messages'. However,
I've just got home so even that isn't an option right now. Your help will be
greatly appreciated; your sympathy more than welcome :-) If you don't have a debugger, you should have an emulator. Writing code
then "plugging it in" to see if it works is not the best or optimimum
process for developing quality code.

Search the web for:
In-Circuit Emulator (ICE)
Emulator (followed by your processor)

Regards
Tim


At my company, the hardware folk have designed a development board
that contains all of the components for the production version, but
also a JTAG port for a debugger and test-point pins. When the code
is working using this board, they place the code into a production
version. The production version has no method for debugging the
code.

--
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 22 '05 #2
Tim
"Thomas Matthews" <Th************ *************** *@sbcglobal.net > wrote in
message news:pi******** **********@news svr31.news.prod igy.com...
Tim wrote:
Please advise if you can.

Presumably initialisation of members in member initialisation lists is
perfomed by 'C' run-time startup. If the CRT was never started-up would
those members be garbage?

Depends on the hardware. Some memory initializes itself to zeros, some
to all ones. But then if the memory was used before this program was
executed, yes, there would be garbage (unknown, random values).
Which of these fundamental language support
features could I expect to be absent (and anything else I might have
missed):

static data zeroing
global data zeroing

static data initialisation
constant data initialisation
global data initialisation
scoped satic data initialisation

static object construction
global object construction
scoped object construction

initialisation of members in member lists

All of the above would not happen if the C++ Run-Time Library
was not invoked (CRTL or CRT). The above takes executable code
to perform. Somehow, the variables must be initialized.

new
delete

As for these, depends on the implementation.
I'm having to fix an embedded PowerPC-based platform that I never worked on and which has many thousands of lines of lamentable source; the only
function it calls from the assembly startup code is Init_CPP_Constr uctors which, in-turn, calls each constructor in an array of constructors in a
'ctors' segment. I see no other CRT startup calls; in fact, I don't even
think this is CRT code; I think it's simply a hand-made 'bare-bones'
startup.

Sounds more like a hook that a compiler manuf. provides for more
flexibility. Sounds familiar, perhaps Metware High C/C++ compiler?
You may also want to post to news:comp.arch. embedded.

If so, would I be correct in assuming that a hefty chunk of support
features will be absent?

Read your compiler documentation. You haven't specified which compiler
you are using.

The firmware actually uses enums, not constant data
and only has a few static variables and global data. It also has one class with members initialised in the list; the rest have members initialised in the constructors. My assumption is that there are quite a few oppertunuties for disaster here; would you agree?

Can't agree or disagree since you haven't posted the code.

If anyone's wondering why I don't simply have a look using a debugger...
there isn't one... nor any trace port; I't a question of downloading to
flash and using a red LED or a green LED for diagnostic 'messages'. However, I've just got home so even that isn't an option right now. Your help will be greatly appreciated; your sympathy more than welcome :-)

If you don't have a debugger, you should have an emulator. Writing code
then "plugging it in" to see if it works is not the best or optimimum
process for developing quality code.

Search the web for:
In-Circuit Emulator (ICE)
Emulator (followed by your processor)

Regards
Tim


At my company, the hardware folk have designed a development board
that contains all of the components for the production version, but
also a JTAG port for a debugger and test-point pins. When the code
is working using this board, they place the code into a production
version. The production version has no method for debugging the
code.


Yes, unfortunately this is not a new product and the particular flavour of
PowerPC used is discontinued and no longer supported. Thanks for your input.
Tim
Jul 22 '05 #3

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

Similar topics

5
4827
by: CoolPint | last post by:
It seems to me that I cannot assign objects of a class which has a constant data member since the data member cannot be changed once the constructor calls are completed. Is this the way it is meant to be? Am I not suppose not to have any constant data member if I am going to have the assignment operator working for the class? Or am I missing something here and there is something I need to learn about? Clear, easy to understand...
8
4579
by: Scott J. McCaughrin | last post by:
The following program compiles fine but elicits this message from the linker: "undefined reference to VarArray::funct" and thus fails. It seems to behave as if the static data-member: VarArray::funct were an extern, but it is declared in the same file (q.v.). What is the remedy for this? =================
7
12450
by: ank | last post by:
Hi, I was curious about how to define static data member of template class. Should I put the definition in a separate source file or in the same header file as its template class? And when this data will be initialized if it is used across many translation unit, assume that it has constructor and needs dynamic initialization? I have blindly searched for the answer but I still not thoroughly
11
2285
by: Enquiries, Hopkins Research | last post by:
Hi all I have a conundrum that is puzzling me. I have a large codebase in C that I am converting to C++ as fast as possible (i.e. slowly because I keep learning new idioms and stumbling with C++ 'features'). One part of the C code is some optimisation functions that expect a pointer to a function which is sent an array of doubles and returns a double i.e. simplified..
3
6373
by: Mike - EMAIL IGNORED | last post by:
MyClass { //I have a static member method: void static myMethod(); //and a static data member: static MyType myData; }; //In the .cpp file: void MyClass::myMethod()
11
2823
by: ziman137 | last post by:
Hi all, I have a question here. What is the rationale behind ISO C++ for Static Member Definition? * ISO C++ forbids in-class definition/initialization of non-constant static member variables. For example, instead of
10
4192
by: n.torrey.pines | last post by:
Are global variables (and const's) guaranteed to be initialized before static class members (and methods) ? const int x = 19907; int get_x() { return x; } // another compilation unit: int get_x();
10
2646
by: stonny | last post by:
I read the following sentence from a c++ website, but can not understand why. can anyone help me with it? " An important detail to keep in mind when debugging or implementing a program using a static class member is that you cannot initialize the static class member inside of the class. In fact, if you decide to put your code in a header file, you cannot even initialize the static variable inside of the header file; do it in a .cpp file...
2
1898
by: .rhavin grobert | last post by:
i have (do try to have?) the following... & = breakpoints in debugger // ---------------------------------------------------------------- // cx.h class CX { public: CX(CX* pcx = NULL); virtual ~CX();
0
8345
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
8857
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8768
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...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7368
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
6186
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
5655
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
4181
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4348
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.