Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Missing StructLayout Sequential for some events  (Read 4359 times)

0 Members and 1 Guest are viewing this topic.

Spodi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://www.netgore.com/
Missing StructLayout Sequential for some events
« on: May 26, 2010, 01:35:21 am »
I am not positive on this one, but it looks like the structs in Event.cs used inside of the Event struct (SizeEvent, JoyButtonEvent, etc) should have the StructLayout(LayoutKind.Sequential) attribute.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Missing StructLayout Sequential for some events
« Reply #1 on: May 26, 2010, 09:24:52 am »
Maybe, honestly I don't know .Net enough to have an opinion about this. But so far it have always worked like a charm.
Laurent Gomila - SFML developer

Spodi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://www.netgore.com/
Missing StructLayout Sequential for some events
« Reply #2 on: May 26, 2010, 10:47:31 am »
Since the Event struct is going between managed and unmanaged, and these structs are inside of that Event struct, I am quite sure that they are needed. I haven't had a problem with it, either, but its always better to be safe than sorry. In general, any struct you use for managed code should have the struct layout type not automatic since you never know what the compiler (or JIT) is going to do. Its always nice to have for reflection, too. ;)

So my opinion is add it just to be safe.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Missing StructLayout Sequential for some events
« Reply #3 on: May 26, 2010, 10:57:05 am »
Yep, I agree. I'll do that as soon as possible, thanks.
Laurent Gomila - SFML developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Missing StructLayout Sequential for some events
« Reply #4 on: May 26, 2010, 07:05:35 pm »
Done.
Laurent Gomila - SFML developer

 

anything