[BIOSAL] Random values vs BASE + xyz vs enum for actions

George K. Thiruvathukal gkt at cs.luc.edu
Wed Nov 5 21:16:46 CST 2014


​I am potentially ok with this. One thing to consider, however, is that C++
(should we ever go in this direction) enum and int don't play nicely
together. Someone might even "wrap" Thorium computations in C++ at some
point, which means we will want the code to pass through the C compiler
without errors. I'm not sure whether this was intentional, but you also
don't have an enum type name in your example.

So I would be careful with enum, because in C, they convert implicitly
to/from int. That said, I do like being able to get the auto-increment
functionality out of the box. I can be talked into it, but were I to guess,
Andy Tanenbaum did what we did today in Minix for good reasons (possibly
still living in his head!)

Best,
George
​

George K. Thiruvathukal, PhD
*Professor of Computer Science*, Loyola University Chicago
*Director*, Center for Textual Studies and Digital Humanities
*Guest Faculty*, Argonne National Laboratory, Math and Computer Science
Division
Editor in Chief, Computing in Science and Engineering
<http://www.computer.org/portal/web/computingnow/cise> (IEEE CS/AIP)
(w) gkt.tv (v) 773.829.4872


On Wed, Nov 5, 2014 at 9:08 PM, Boisvert, Sebastien <boisvert at anl.gov>
wrote:

> Hi George,
>
> The new action definitions that use a base and an offset is great [1].
>
> #define ACTOR_ACTION_BASE -1000
>
> #define ACTION_START (ACTOR_ACTION_BASE + 0)
> #define ACTION_START_REPLY (ACTOR_ACTION_BASE + 1)
> #define ACTION_STOP (ACTOR_ACTION_BASE + 2)
> #define ACTION_STOP_REPLY (ACTOR_ACTION_BASE + 3)
> #define ACTION_ASK_TO_STOP (ACTOR_ACTION_BASE + 4)
> #define ACTION_ASK_TO_STOP_REPLY (ACTOR_ACTION_BASE + 5)
>
>
> I was told by a friend (from industry) of mine that the following would be
> better:
>
> enum {
>     ACTOR_ACTION_BASE = -1000,
>     ACTION_START,
>     ACTION_START_REPLY,
>     ACTION_STOP,
>     ACTION_STOP_REPLY,
>     ACTION_ASK_TO_STOP,
>     ACTION_ASK_TO_STOP_REPLY
> };
>
>
> What do you think ?
>
>
> ---
> [1]
> https://github.com/gkthiruvathukal/biosal/commit/8e0448d4c98babd9e471d134745791165fb08536
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cels.anl.gov/pipermail/biosal/attachments/20141105/b9ed2ab7/attachment-0001.html>


More information about the BIOSAL mailing list