stolk / GPGOAP

General Purpose Goal Oriented Action Planning
558 stars 63 forks source link

const-ness #11

Closed ghost closed 10 months ago

ghost commented 10 months ago

running A* never modifies a planner.

stolk commented 10 months ago

Thanks. Did you find that w a static analyzer, or a compiler warning? Or just by reading the code?

ghost commented 10 months ago

Huh... because I'm a "fascist dev who knows is not smart enough to do things without help" I guess?

const is a very magic thing to me, it have the advantages of being all of:

I also tend to enable all warnings, and only silent those that I understand are not bad for my use case (i.e. "hey, this is not compatible with C++98", or the "hey, doxygen won't understand this doc"). So I use clang (more warnings than gcc, by far) with -Wall -Weverything. The -Wall is to have one less tweak to do when I swap to gcc for some reason. When I used gcc, I did used -Wextra though, but gcc finds so much less warnings that it's only the compiler I'd take to build releases of a project that officially uses gcc to build stuff, to reduce the likely-ness of problems related to UBs.

Does this answer your question?

Also, while we're "out of topic": I have some weird behavior in a program, but I'm not sure a GH "issue" to ask would be well received? I am working at replacing a NiH behavior tree implementation in Unvanquished by GOAP, using GPGOAP for now despite I smell I might need a more advanced tool in future, because it has a simple interface, but for now, it should be enough to be on par with current implementation. I'm a bit in the blur as I could not find any open source program using GOAP, so I have no codebase to study to see for a real world example. This lib is giving me a great help for now. I even baked me a (very) little (C++) program that generates a graphviz description, I can pipe this text into dot -Tpdf | zathura - to get some hint... but let' talk about this in another issue, if that's ok? I could even contribute back both that program and the set of macros I'm using to make the thing easier to setup: the action code really looks more like a DSL this way, parsable with cpp (the C preprocessor, not the lang) so it should be possible to redo it in C if needed. I'm just too lazy to bother anymore with manual allocations...

In C++, I think GPGOAP also have other warnings (I'd need to check) but I'm unsure how much fixing them would be in scope.