I'd completely agree with Consistency is Goodâ„¢ of course
Anyway, slightly neater version of my loadfx/savefx patch attached (as an svn diff)

[The extension has been deactivated and can no longer be displayed.]
Neither can I. Especially not when GCC has proven to be the better of the non-free compiler.pseudonym404 wrote: I just can't understand using a non-free compiler on a platform where gcc is available
Believe me, you'll learn to understand that when you've got people (read "teachers") (litterally) cursing at you and declaring you mad because you're not using the holy & mighty newest version of whinersâ„¢ from microknowledgeâ„¢. Especially when these teachers judge your papers on the fact that you're not using font X from the before mentioned brand.pseudonym404 wrote: mind you, I can't understand using a non-free platform when there's free platforms available either

Ah yes, the fun of hoop jumping. Never been a favourite passtimeGiel wrote: Believe me, you'll learn to understand that when you've got people (read "teachers") (litterally) cursing at you and declaring you mad because you're not using the holy & mighty newest version of whinersâ„¢ from microknowledgeâ„¢. Especially when these teachers judge your papers on the fact that you're not using font X from the before mentioned brand.

[The extension has been deactivated and can no longer be displayed.]
But when you find a variable that you do not know the definition of, at least you know where to find its definition. In the define-whereever-you-want style, the definition could be at any line above the one you happen to be reading.Giel wrote: I disagree. Not having to browse to the top of the function to see what type a variable is when you see it first used is a luxury IMO. Also the knowledge that the variable didn't exist before a certain line is nice to know, because that tells you it can't have undergone changes before that line/statement.
Well, while looking at that code I found that most of the code in there was a bit of a mess (i.e. the original code before applying your patch). So instead I just rewrote those functions in a 64bit safe manner, and somewhat cleaner (I hopepseudonym404 wrote: Anyway, slightly neater version of my loadfx/savefx patch attached (as an svn diff)![]()
In short: both styles have their advantages and disadvantages.Per wrote: But when you find a variable that you do not know the definition of, at least you know where to find its definition. In the define-whereever-you-want style, the definition could be at any line above the one you happen to be reading.

looks better to meGiel wrote: Well, while looking at that code I found that most of the code in there was a bit of a mess (i.e. the original code before applying your patch). So instead I just rewrote those functions in a 64bit safe manner, and somewhat cleaner (I hope).
Nope, it needs to be cast through a pointer to make sure I don't get a conversion from a float to uint32_t, instead I need a reinterpretation of the bits. Which AFAIK can only be achieved by pointer casting. So instead I've added a void cast:pseudonym404 wrote: Although, in lib/framework/frame.h, couldn't
uint32_t writeValue = *(uint32_t*)&val;
simply be
uint32_t writeValue = (uint32_t)val;
to avoid "frame.h:235: warning: dereferencing type-punned pointer will break strict-aliasing rules"?![]()
Code: Select all
uint32_t writeValue = *(uint32_t*)(void*)&val;
Thanks that helped in triggering the warning myself.pseudonym404 wrote: This is one of the "ambiguous cases that are safe" that -Wstrict-aliasing=2 (enabled by -fstrict-aliasing, which is enabled by -O2) warns about of course![]()

[The extension has been deactivated and can no longer be displayed.]
Applied in r2397.pseudonym404 wrote: And a small patch to work around asWeaps[n] still being set for IDES_SYSTEM turrets when numWeaps == 0
Stops segfaults when hovering over a different propulsion type button than currently selected for an existing non-weapons turret
Also stops system turrets being 'forgotten' when changing propulsion type on an existing design (effectively reverses the current behaviour of intCheckValidWeaponForProp considering all existing system turrets invalid for all propulsion types)

[The extension has been deactivated and can no longer be displayed.]

[The extension has been deactivated and can no longer be displayed.]
Actuallypseudonym404 wrote: looks better to me
Although, in lib/framework/frame.h, couldn't
uint32_t writeValue = *(uint32_t*)&val;
simply be
uint32_t writeValue = (uint32_t)val;
to avoid "frame.h:235: warning: dereferencing type-punned pointer will break strict-aliasing rules"?
This is one of the "ambiguous cases that are safe" that -Wstrict-aliasing=2 (enabled by -fstrict-aliasing, which is enabled by -O2) warns about of course
Code: Select all
uint32_t writeValue = *(uint32_t*)&val;
Code: Select all
void funcfoo(float float_in)
{
union {
float f;
int i;
} u;
int should_get_mem_contents_of_float_in;
u.f = float_in;
should_get_mem_contents_of_float_in = u.i;
/* ......
.....
...... */
}
