Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Code::Blocks, Scintilla and Fedora
Loaden:
--- Quote from: jens on November 08, 2010, 12:21:17 pm ---Can you test my new patch, works for me on XP SP3, wx2.8.10 and TDM gcc 4.5.0 (just for the core project-file at the moment).
--- End quote ---
Well done! testing passed.
And have a issue, I think we need change the lib name from "libwxscintilla.a" to "libcbscintilla.a" or "libwxscintilla_cb.a".
Because in wx2.9.x, the wxscintilla library named "libwxscintilla.a" too. :)
Loaden:
--- Quote from: jens on November 08, 2010, 04:34:13 pm ---
--- Quote from: Loaden on November 08, 2010, 03:37:55 pm ---
--- Quote from: oBFusCATed on November 08, 2010, 02:57:13 pm ---
--- Quote from: MortenMacFly on November 08, 2010, 02:11:17 pm ---...This is a structure and if you only set the first value to zero, the other values may still be invalid on initialisation (platform / compiler dependent).
--- End quote ---
Hm, C++ standard says that the unspecified members are initialized with zero (If I remember correctly).
--- End quote ---
I can sure it, so, I think it maybe not needed to hack.
--- End quote ---
But it should be
--- Code: ---SCNotification scn = {{0}};
--- End code ---
--- End quote ---
No, you can use just {0}.
See:
--- Code: ---#include <iostream>
using namespace std;
struct A
{
int i;
float j;
char c;
int* p;
};
int main()
{
A a = {0};
cout << a.i << "," << a.j << "," << a.c << "," << a.p << endl;
return 0;
}
--- End code ---
Jenna:
It's not correct in our case, because the first element of the struct is a struct, that needs to be initialised with {0} itself.
All other elements are set to zero (or their default values ?) automagically.
--- Code: ---#include <iostream>
using namespace std;
struct B
{
int j;
};
struct A
{
struct B b;
int i;
float j;
char c;
int* p;
};
int main()
{
A a = {0};
cout << a.b.j << "," << a.i << "," << a.j << "," << a.c << "," << a.p << endl;
return 0;
}
--- End code ---
leads to warning:
--- Code: ---main.cpp:21:13: warning: missing braces around initializer for ‘B’
--- End code ---
even if it works.
MortenMacFly:
--- Quote from: jens on November 08, 2010, 05:29:17 pm ---It's not correct in our case, because the first element of the struct is a struct, that needs to be initialised with {0} itself.
All other elements are set to zero (or their default values ?) automagically.
--- End quote ---
That's what I meant: For me it is not really clear what is fully correct. Even if it may work due to the standard (what does the standard say about initialising structs within structs btw?!) as it is now - it'll definitely work reliable.
So again my question: What's the issue with it?
Loaden:
--- Quote from: jens on November 08, 2010, 05:29:17 pm ---It's not correct in our case, because the first element of the struct is a struct, that needs to be initialised with {0} itself.
All other elements are set to zero (or their default values ?) automagically.
leads to warning:
--- Code: ---main.cpp:21:13: warning: missing braces around initializer for ‘B’
--- End code ---
even if it works.
--- End quote ---
In VC++2010, their have no warning when use {0} to initialize a struct member variable.
So, We can avoid this warning in project settings.
This is C++ standard behavior. So, don't worry, all the member will initialize to zero.
Include struct member value. :)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version