Git Product home page Git Product logo

Comments (17)

andrew-gresyk avatar andrew-gresyk commented on June 9, 2024

Thanks for reporting!

I'm assuming this is GCC?
Which version is this on?

from hfsm.

kgreenek avatar kgreenek commented on June 9, 2024

NP! Yes gcc. I've been scouring the code to see if I can figure it out, but so far to no avail. Here's the gcc version:

$ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

from hfsm.

andrew-gresyk avatar andrew-gresyk commented on June 9, 2024

Interestingly, I've got no issues with Visual Studio 2017.
Will have to look at this over the weekend.

Out of curiosity - how did you find this repo?
Are you trying to use it in your own project?

from hfsm.

kgreenek avatar kgreenek commented on June 9, 2024

Thanks!

I found it by searching "finite state machine language:c++" on github. This is like the 3rd repo that comes up, and it looks to be the most useful for my use-case :)

from hfsm.

andrew-gresyk avatar andrew-gresyk commented on June 9, 2024

:)
What kind of app are you building with it?

from hfsm.

kgreenek avatar kgreenek commented on June 9, 2024

I work for a startup called area17 that does robotics. I need a simple state machine for handling a node state (starting, running, stopping, idle, etc.). We also have 3 or 4 other places in or code where state machines are implemented (sadly) as nested switch statements, and I don't want to repeat that mistake ;)

Was about to start writing my own when I came across this.

from hfsm.

andrew-gresyk avatar andrew-gresyk commented on June 9, 2024

Nice. Nested switch statements is the very reason I made HFSM in the first place :)

Even thought it was originally made for games, it should suit embedded well since it doesn't allocate any memory dynamically.

from hfsm.

andrew-gresyk avatar andrew-gresyk commented on June 9, 2024

Interestingly, this assert seems to be Linux specific.
I'm normally on windows, and all of the Visual Studio, GCC and Clang work perfectly fine.

I'll try reproducing it on a Linux VM.

from hfsm.

kgreenek avatar kgreenek commented on June 9, 2024

I also just tested it on aarch64 (an Nvidia TX1) running Ubuntu 16.04, and the tests pass!

So it appears to be specific to Linux on x86_64.

from hfsm.

kgreenek avatar kgreenek commented on June 9, 2024

I wonder if it has something to do with the use of #pragma pack? Just a guess. I've never used that particular pattern before.

from hfsm.

andrew-gresyk avatar andrew-gresyk commented on June 9, 2024

Might be! Could you try commenting out those?
I've added them only to save memory, they shouldn't affect the logic at all.

from hfsm.

kgreenek avatar kgreenek commented on June 9, 2024

If I comment them out, I get a different exception:

hfsm_test: ../test/../hfsm/detail/array.hpp:31: hfsm::detail::Array<T, TCapacity>::Array() [with T = hfsm::M<Context, 4u>::Transition; unsigned int TCapacity = 6u]: Assertion `&View::get(0) == _storage' failed.

from hfsm.

kgreenek avatar kgreenek commented on June 9, 2024

I spent some time digging into that, and for the life of me don't understand why commenting out the #pragma pack logic should break that.

from hfsm.

andrew-gresyk avatar andrew-gresyk commented on June 9, 2024

It changes memory layout.
I'm using some hacky reinterpret_cast<>() -style memory management.. :)

from hfsm.

kgreenek avatar kgreenek commented on June 9, 2024

Ewwwwww lol. I looked at it though and couldn't immediately come up with a different way without making big changes

from hfsm.

andrew-gresyk avatar andrew-gresyk commented on June 9, 2024

Fixed it!

from hfsm.

kgreenek avatar kgreenek commented on June 9, 2024

Nice! I pulled HEAD and verified that it works on Linux x86_64.

Also, I sent out this PR a couple days ago. Would appreciate if you would merge (if you think it makes sense). I basically just implemented the stuff in your CMakeLists.txt that is needed to use this project from other cmake projects (i.e. my project).

#3

from hfsm.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.