Back in 2015 I posted code on the Parallax Forums that I wrote to emulate a few logic chips (link: https://forums.parallax.com/discussion/160846/chipulater-propeller-logic-emulator ) in Spin languange for the P8X32A Propeller Microcontroller.
I would like to convert it to C/C++ for use on teensy 4.X, I've searched and have gotten myself a bit confused as what would be the correct, or recomended. I see an enum can be declared a few different ways, here are the methods used to declare enums I see through the plethora of available code in search results:
1.) Name of enum after coder
2.) name of enum before code
3.) name of enum both before and after with differnent casing
4,5,6.) same as the three above but with "typedef enum...".
So... which one is prefered common practice, does it matter? Is one method for C and the other for C++?
Thank you in advance.
I would like to convert it to C/C++ for use on teensy 4.X, I've searched and have gotten myself a bit confused as what would be the correct, or recomended. I see an enum can be declared a few different ways, here are the methods used to declare enums I see through the plethora of available code in search results:
1.) Name of enum after coder
Code:
enum{
choice-01,
choice-02,
choice-03
} someEnum;
2.) name of enum before code
Code:
enum someEnum{
choice-01,
choice-02,
choice-03
};
3.) name of enum both before and after with differnent casing
Code:
enum someEnum{
choice-01,
choice-02,
choice-03
} SomeEnum;
4,5,6.) same as the three above but with "typedef enum...".
So... which one is prefered common practice, does it matter? Is one method for C and the other for C++?
Thank you in advance.