• Content count

  • Joined

  • Last visited

Community Reputation

504 Good

About Starfox

  • Rank
  1. Registering strongly-typed class nested enums

    :( I'm a bit heartbroken. I would have loved to have parity between C++ and AngelScript syntax. This wouldn't affect us much since our AS script path is in maintenance mode while we transition to Lua (for a bunch of unrelated reasons) but I'd love to see support for class enums in AS eventually.
  2. I'm using AS 2.24.0. I have a class like this:   [source] class foo { public: enum class state : int { a = 0, b, c }; }; [/source]   I want to register that in AngelScript. I have registration code like this:   [source] Engine->RegisterObjectType("foo", sizeof(foo), asOBJ_REF | asOBJ_NOCOUNT);     //     Engine->RegisterEnum("foo::state");     Engine->RegisterEnumValue("foo::state", "stopped", static_cast<int>(foo::state::a));     Engine->RegisterEnumValue("foo::state", "playing", static_cast<int>(foo::state::b));     Engine->RegisterEnumValue("foo::state", "paused", static_cast<int>(foo::state::c)); [/source]   However, I seem to be getting errors due to the following piece of AS code in asCScriptEngine::ResgisterEnum:   [source] // Make sure the name is not a reserved keyword size_t tokenLen; int token = tok.GetToken(name, strlen(name), &tokenLen); if( token != ttIdentifier || strlen(name) != tokenLen ) return ConfigError(asINVALID_NAME, "RegisterEnum", name, 0); [/source]   What am I doing wrong here?
  3. array performance / direct memory access?

    You might be better off embedding Python in your app - check it out, it's simple.
  4. Alignment requirements

    Bug fix for crash on querying the alignment of a built-in type:
  5. Alignment requirements

    Bug fix for allocation / deallocation mismatch:
  6. Alignment requirements

    I'm trying to add aligned allocation support to asCCompiler::AllocateVariable() and I'm not sure exactly what the function does internally. Any clarification?    Also, is there any interest in merging these changes with the main AngelScript trunk? We'd love to have the feature officially supported but if there's no interest (and I'm not sure whether there is, seeing as how none of the patches were accepted) we could just do some internal hacks to get our code working and stick to that version.
  7. Alignment requirements

      Necessity is the mother of all crunch periods.
  8. Alignment requirements

    Type info defaults to 4-byte alignment:
  9. Alignment requirements

    Commits for aligned allocation support:   Global property support for aligned allocation:
  10. Alignment requirements

    CScriptEngine's CallAlloc() and CallFree() now respect type alignment:
  11. Alignment requirements

    Added support for aligned allocation:
  12. Alignment requirements

      Not really, I can't get the test harness to work on my system. We test internally but out test isn't as comprehensive. Would it be too much to ask you to test my patches? Sorry.
  13. Alignment requirements

      Some types do need natural alignment though, and the default allocator (that wraps malloc()) is already aligning to the largest supported type alignment on the platform, since malloc() is guaranteed to do that. On OS X, my primary platform, malloc() is guaranteed to return 16 byte aligned data. On almost every platform with doubles aligned is required by the spec to return a pointer that is at least as aligned as a double (8 bytes).    Also, the patches add an alignment type to the type id info that defaults to 4, and that's what'll get passed to allocators when allocating memory for a type - so in existing code the behavior of the changes should be exactly identical.
  14. Alignment requirements

    ^^ what he said.
  15. Alignment requirements

    vmovaps requires 32-byte alignment. We also see a performance benefit from aligning matrices on 32 or 64 byte boundaries due to cache behavior.