What would be the best way to represent enums? It has been a while since I wrote pike code, so I'm looking in the docs and can't see anything. Maybe just a bunch of constants? Or maybe a class (or struct)? Thanks
On Thu, Feb 04, 2021 at 01:08:56PM +0000, Lance Dillon wrote:
What would be the best way to represent enums? It has been a while since I wrote pike code, so I'm looking in the docs and can't see anything. Maybe just a bunch of constants? Or maybe a class (or struct)?
I think the best enum representation would be just enum.
#v+ enum foo_t { ONE = 0, TWO = 1, THREE = 2 };
foo_t nabla = ONE;
write("ONE + TWO = THREE\n%d + %d = %d\n", ONE, TWO, THREE); #v-
Ah, I was trying to search for enum in the pike docs, but nothing showed up on the web page. I'll have to try to search further and see where it is located. Thanks
On Thursday, February 4, 2021, 11:02:12 AM EST, Stanislaw Klekot pike@jarowit.net wrote:
On Thu, Feb 04, 2021 at 01:08:56PM +0000, Lance Dillon wrote:
What would be the best way to represent enums? It has been a while since I wrote pike code, so I'm looking in the docs and can't see anything. Maybe just a bunch of constants? Or maybe a class (or struct)?
I think the best enum representation would be just enum.
#v+ enum foo_t { ONE = 0, TWO = 1, THREE = 2 };
foo_t nabla = ONE;
write("ONE + TWO = THREE\n%d + %d = %d\n", ONE, TWO, THREE); #v-
pike-devel@lists.lysator.liu.se