There's a syntax to initialize structures that has explicit field names.
It would be better to use it in the defaults structure, since SystemInfo could eventually change (actually it's quite likely to change). With explicit field names, the compiler will issue errors and warnings.
If you post an updated patch, I'll check a few things but I think this could go in. Without explicit field names it's a bit fragile and will introduce bugs whenever someone changes SystemInfo (since the compiler will happily ignore missing or mismatching fields in many situations).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
View and moderate all "patches Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Patches"
There's a syntax to initialize structures that has explicit field names.
It would be better to use it in the defaults structure, since SystemInfo could eventually change (actually it's quite likely to change). With explicit field names, the compiler will issue errors and warnings.
If you post an updated patch, I'll check a few things but I think this could go in. Without explicit field names it's a bit fragile and will introduce bugs whenever someone changes SystemInfo (since the compiler will happily ignore missing or mismatching fields in many situations).
View and moderate all "patches Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Patches"
like that :
struct point p = { .y = yvalue, .x = xvalue };
http://gcc.gnu.org/onlinedocs/gcc-4.6.1/gcc/Designated-Inits.html
I couldn't get that kind of thing working in C++ wheareas in plain C it does...
Is there something similar that could be used there ?
https://sourceforge.net/u/stories/sell-games-online/?source=directory
Last edit: Anonymous 2015-08-30
Pity.
Then the other option is to do explicit assignments:
static bool initialized = false;
static struct point p;
if (!initialized) {
initialized = true;
p.x = xvalue;
p.y = yvalue;
}
It's not as pretty, but is safe from changes to the underlying struct.
klauss, does your last change look good enough for commit?
If it builds, yes.