• Create Account

Need scary sound effects or creepy audio loops for your next horror-themed game? Check out Highscore Vol.3 - The Horror Edition in our marketplace. 50 sounds and 10 loops for only \$9.99!

### #ActualKhatharr

Posted 01 January 2013 - 08:50 AM

Does the bold statement mean that I'm not actually breaking the strict aliasing rule here, because the aliased value (i.e. id) is actually the correct type in both structures?

That's my understanding of it.

Uwaah. Bregma ninja'd me.

I'll elaborate a little on what I mean. I see libs all the time that use structs that start with a member like cbSize indicating the length of the struct and then having more than one version or allow for the future addition of new versions.

Oh. Now that I'm looking at the code again I see that Bregma is correct. For some reason I thought you put a Foo in there.

struct Foo {
int a;
int b;
};

struct Bar {
Foo derp;
int c;
};

Bar thing;
((Foo)thing).a;


I think that's what he's saying. You confused me there for a minute by having the 'Command' type as well as the 'Commands' type, lol.

### #4Khatharr

Posted 01 January 2013 - 08:50 AM

<blockquote class="ipsBlockquote" data-author="Hodgman" data-cid="5016362"><p>Does the bold statement mean that I'm not actually breaking the strict aliasing rule here, because the aliased value (<em>i.e. <span style="font-family:courier;">id</span></em>) is actually the correct type in both structures?</p></blockquote><br />That's my understanding of it.<br /><br />Uwaah. Bregma ninja'd me.<br /><br />I'll elaborate a little on what I mean. I see libs all the time that use structs that start with a member like cbSize indicating the length of the struct and then having more than one version or allow for the future addition of new versions.<br /><br />Oh. Now that I'm looking at the code again I see that Bregma is correct. For some reason I thought you put a Foo in there.<br />&nbsp;<pre class="_prettyXprint _lang-auto _linenums:0">struct Foo {
int a;
int b;
};

struct Bar {
Foo derp;
int c;
};

Bar thing;
((Foo)thing).a;
</pre><br />I think that's what he's saying. You confused me there for a minute by having the 'Command' type as well as the 'Commands' type, lol.

### #3Khatharr

Posted 01 January 2013 - 08:47 AM

Does the bold statement mean that I'm not actually breaking the strict aliasing rule here, because the aliased value (i.e. id) is actually the correct type in both structures?

That's my understanding of it.

Uwaah. Bregma ninja'd me.

I'll elaborate a little on what I mean. I see libs all the time that use structs that start with a member like cbSize indicating the length of the struct and then having more than one version or allow for the future addition of new versions.

Oh. Now that I'm looking at the code again I see that Bregma is correct. For some reason I thought you put a Foo in there.

struct Foo {
int a;
int b;
};

struct Bar {
Foo derp;
int c;
};

Bar thing;
((Foo)thing).a;


### #2Khatharr

Posted 01 January 2013 - 08:46 AM

<blockquote class="ipsBlockquote" data-author="Hodgman" data-cid="5016362"><p>Does the bold statement mean that I'm not actually breaking the strict aliasing rule here, because the aliased value (<em>i.e. <span style="font-family:courier;">id</span></em>) is actually the correct type in both structures?</p></blockquote><br />That's my understanding of it.<br /><br />Uwaah. Bregma ninja'd me.<br /><br />I'll elaborate a little on what I mean. I see libs all the time that use structs that start with a member like cbSize indicating the length of the struct and then having more than one version or allow for the future addition of new versions.<br /><br />Oh. Now that I'm looking at the code again I see that Bregma is correct. For some reason I thought you put a Foo in there.<br /><pre class="_prettyXprint _lang-auto _linenums:0">struct Foo {
int a;
int b;
};

struct Bar {
Foo derp;
int c;
};

Bar thing;
((Foo)thing).a;
</pre>

### #1Khatharr

Posted 01 January 2013 - 08:40 AM

That's my understanding of it.

PARTNERS