473,756 Members | 8,132 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

does "struct_nam e var = { 0 }; " fill var with 0?

I have seen this syntax and would like to know weither var_name is entirely
filled with zeroes or only a first few bytes are zeroed (for example the
first field of the structure).

I have of course tried it with MSVC and it seemed to fill the entire
structure, but is this the norm? Where can I find more informations?

thanks in advance,
Fred


Jul 19 '05 #1
6 2295
On Sun, 10 Aug 2003 10:47:02 +0200, "Fred" <da**********@f ree.fr> wrote:
I have seen this syntax and would like to know weither var_name is entirely
filled with zeroes or only a first few bytes are zeroed (for example the
first field of the structure).

I have of course tried it with MSVC and it seemed to fill the entire
structure, but is this the norm?
Yes.

Where can I find more informations?


The C++ standard.

Jul 19 '05 #2
On Sun, 10 Aug 2003 10:47:02 +0200, "Fred" <da**********@f ree.fr> wrote:
I have seen this syntax and would like to know weither var_name is entirely
filled with zeroes or only a first few bytes are zeroed (for example the
first field of the structure).

I have of course tried it with MSVC and it seemed to fill the entire
structure, but is this the norm?
Yes.

Where can I find more informations?


The C++ standard.

Jul 19 '05 #3
Thanks for such a fast answer. Do you have a good online source for
occasionnaly reading the norm?

"Alf P. Steinbach" <al***@start.no > a écrit dans le message de news:
3f************* ***@News.CIS.DF N.DE...
On Sun, 10 Aug 2003 10:47:02 +0200, "Fred" <da**********@f ree.fr> wrote:
I have seen this syntax and would like to know weither var_name is entirelyfilled with zeroes or only a first few bytes are zeroed (for example the
first field of the structure).

I have of course tried it with MSVC and it seemed to fill the entire
structure, but is this the norm?


Yes.

Where can I find more informations?


The C++ standard.

Jul 19 '05 #4
Thanks for such a fast answer. Do you have a good online source for
occasionnaly reading the norm?

"Alf P. Steinbach" <al***@start.no > a écrit dans le message de news:
3f************* ***@News.CIS.DF N.DE...
On Sun, 10 Aug 2003 10:47:02 +0200, "Fred" <da**********@f ree.fr> wrote:
I have seen this syntax and would like to know weither var_name is entirelyfilled with zeroes or only a first few bytes are zeroed (for example the
first field of the structure).

I have of course tried it with MSVC and it seemed to fill the entire
structure, but is this the norm?


Yes.

Where can I find more informations?


The C++ standard.

Jul 19 '05 #5
On Sun, 10 Aug 2003 11:28:11 +0200, "Fred" <da**********@f ree.fr> wrote:

[Don't top-post. Rearranged]
"Alf P. Steinbach" <al***@start.no > a écrit dans le message de news:
3f************ ****@News.CIS.D FN.DE...
On Sun, 10 Aug 2003 10:47:02 +0200, "Fred" <da**********@f ree.fr> wrote:
>I have seen this syntax and would like to know weither var_name isentirely >filled with zeroes or only a first few bytes are zeroed (for example the
>first field of the structure).
>
>I have of course tried it with MSVC and it seemed to fill the entire
>structure, but is this the norm?


Yes.

>Where can I find more informations?


The C++ standard.


Thanks for such a fast answer. Do you have a good online source for
occasionnaly reading the norm?


[http://dmoz.org/Computers/Programmin...++/Standards/]
Jul 19 '05 #6
On Sun, 10 Aug 2003 11:28:11 +0200, "Fred" <da**********@f ree.fr> wrote:

[Don't top-post. Rearranged]
"Alf P. Steinbach" <al***@start.no > a écrit dans le message de news:
3f************ ****@News.CIS.D FN.DE...
On Sun, 10 Aug 2003 10:47:02 +0200, "Fred" <da**********@f ree.fr> wrote:
>I have seen this syntax and would like to know weither var_name isentirely >filled with zeroes or only a first few bytes are zeroed (for example the
>first field of the structure).
>
>I have of course tried it with MSVC and it seemed to fill the entire
>structure, but is this the norm?


Yes.

>Where can I find more informations?


The C++ standard.


Thanks for such a fast answer. Do you have a good online source for
occasionnaly reading the norm?


[http://dmoz.org/Computers/Programmin...++/Standards/]
Jul 19 '05 #7

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

Similar topics

2
3509
by: Steven T. Hatton | last post by:
I'm still not completely sure what's going on with C++ I/O regarding the extractors and inserters. The following document seems a bit inconsistent: http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#1 Copying a file: WRONG WAY: #include <fstream> std::ifstream IN ("input_file"); std::ofstream OUT ("output_file");
6
2007
by: John Baker | last post by:
Hi: Does "On Open" code execute before or after related data is loaded? I want to test before the form appears on the screen to see if there is any data in the queryresult, and if there is not then I want to close the form unseen by the end user. Regards John baker
1
2409
by: John Bailo | last post by:
using ( SqlCommand cmd = new SqlCommand("select * sample"), new SqlConnection( sqlDsn ) ) ) { SqlDataAdapter adapter = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); adapter.Fill(dt);
1
1835
by: DougFAI | last post by:
Hello there. Today, I was developing a college work software and then I saw thoe 2 types of while. My teacher asked me how does the "while(ifs)" (considering my ifstream was ifs) (that was the one I was using) should work, I didn't know what to answer. Both of em works to check the enf of the file in, right? Whats the advantage in using while(ifs)? How does the "ifs" works. Thanks in the advance. :)
4
3082
by: jaime | last post by:
Hi again all. Given the line: const int x=5; Can I then use "x" as a constant expression? (By "constant expression", I mean "constant expression" as defined in the C99 standard) I've been searching google for 2 days now trying to answer this myself, and I'm just getting more and more confused (some things I read make me think "yes", while some things I read make me think "no").
3
3214
by: dvanderwel | last post by:
I have a .NET 1.1 web page with a DataGrid containing a TemplateColumn that contains a DropDownList. I need to fire an event when the selected item in the DropDownList changes for the current DataGrid row, and I'm having trouble figuring out how to do this. Other control types I have defined the "CommandName" property in the aspx file. The event returns the index of the row that contains the control, and I can thus pull more data out...
1
2130
by: Curious | last post by:
I have the following code: if (this.InvokeRequired) { IAsyncResult result = this.BeginInvoke(new EventHandler(this.UpdateButtons), new object { this, EventArgs.Empty }); while ((!result.IsCompleted) && (result.AsyncWaitHandle.WaitOne(100, false)))
4
3101
by: lander | last post by:
I've read the page life cycle thing in msdn, still, i'm getting a bit confused of thinking how all the things are going under the hood... I know that when page loading, that the controls' properties is populated and when page unloading, the resources are cleared. What I want to know is what's happening behind it, that is, from the perspective of the asp.net implementor.....I'm not sure whether i've stated clearly, hope you get it.
9
27635
by: erictheone | last post by:
Ok so what I'm trying to do is create a trans location cipher. For those among us that don't know alot about cryptography it is a method for jumbling up letters to disguise linguistic patterns(words). What it does is takes a string as a parameter, determines length of string, tests if the length is a perfect square, if it is then it makes a 2-d array with its length and height equal to the lengths root. If it isn't then it cuts it down to...
0
10040
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
9873
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
7248
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
6534
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
5142
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
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3806
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3359
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2666
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.