Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Enum in code #18

Open
maisonsmd opened this issue Dec 23, 2018 · 0 comments
Open

Use Enum in code #18

maisonsmd opened this issue Dec 23, 2018 · 0 comments

Comments

@maisonsmd
Copy link

maisonsmd commented Dec 23, 2018

You should use enum (or at least #define) to name constants such as LEFT_LEGS, RIGHT_LEGS,... instead of using number like 0, 1 which decreases the code readability.
for example:

enum LegSides{
    LEFT_LEGS = 0,
    RIGHT_LEGS = 1
};

or just forget the numbers:

enum LegSides{
    LEFT_LEGS,
    RIGHT_LEGS
};

then the function:

double leg(double Z, double Y, double X2, int side) {...}

will be:

double leg(double Z, double Y, double X2, LegSides side) {...}

and call it:

leg(x, y, z, LEFT_LEGS);

further here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant