473,769 Members | 3,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A paragraph from Bjarne stroustrup's Book

7 New Member
How to understand the following paragraph from Bjarne stroustrup's The C++ Programming Language?
9.4.1:
In principle, a variable defined outside any function (that is, global, namespace, and class static variables) is initialized before main() is invoked. Such nonlocal variables in a translation unit are
initialized in their declaration order (§10.4.9). If such a variable has no explicit initializer, it is by default initialized to the default for its type (§10.4.2). The default initializer value for builtin types and enumerations is 0 . For example:

Does it mean:
class Example
{
static int DataMember;
}
DataMember automatically intialized to 0.
This seems to be wrong.
Feb 15 '08 #1
1 1811
weaknessforcats
9,208 Recognized Expert Moderator Expert
Youe have just declared a static member variable but you haven't defined it.

When you define it, the default initialization will be 0.

You might read this: http://www.thescripts.com/forum/thread737451.html.
Feb 15 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

13
1889
by: Teddy | last post by:
Hello all Bjarne Stroustrup says "The most important thing to do when learning C++ is to focus on concepts and not get lost in language-technical details" and "Focus on programming techniques, not on language features" in his book <The C++ Programming Language>. I don't follow these. What does Bjarne Stroustrup actually mean?
3
1712
by: devser2006 | last post by:
Do You Want The Book C++ Programming Language By Bjarne Stroustrup? If yes , please download a screensaver from http://www.geocities.com/screensaver_200and email me that you have downloaded the screensaver I will send you the C++ Programming Book.
1
1955
by: Mike | last post by:
Hi, I'm auctioning the book "The C++ Programming Language" 3rd Ed. by Bjarne Stroustrup on ebay, details as follows or see eBay item number 250030480853. Softback. Condition : Good. Pub. Addison Wesley 1997. 3rd Edition. 910 pages. "The C++ Programming Language" by Bjarne Stroustrup is the classic C++
17
4719
by: CoreyWhite | last post by:
I bought this book years ago, when I was just learning C++. Since then I've gone through every math course offered at my college, taken courses on coding C & thinking in terms how how to make the smallest tightest algorithms to preform specific functions. I've also grown and matured a lot, and am wiser and older. I'm reading through the C+ + Programming Language, Third Edition now, and I can actually understand it. I can understand it...
2
1791
by: Rakesh UV | last post by:
Hi, I searched on google for this book "The c++ programming language by Bjarne Stroustrup's" but i diidnt get any which is free, Thanks in advance Rakesh UV
20
2169
by: gremlin | last post by:
http://www.cilk.com/multicore-blog/bid/6703/C-Inventor-Bjarne-Stroustrup-answers-the-Multicore-Proust-Questionnaire
0
1831
by: gremlin | last post by:
http://www.cilk.com/multicore-blog/bid/6703/C-Inventor-Bjarne-Stroustrup-answers-the-Multicore-Proust-Questionnaire
1
3533
by: blangela | last post by:
Bjarne Stroustrup has a new text coming out called "Programming: Principles and Practice Using C++" (ISBN: 0321543726), due to be published in December of this year. Some of the features of this new text include: *Its history: The text was developed in the author's introductory programming course at Texas A&M and has been used successfully by hundreds of students.
3
2435
by: HL | last post by:
As the subject, I like the font he used for codes. It's not constant- width but better than constant-width fonts while presenting text. Netters, could you tell me the name of that font? I hope to use it in my writing. Thank you.
0
9579
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
9420
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
10205
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
9851
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
8863
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...
0
6662
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
5293
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
5441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2811
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.