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

Implement struct with typedef struct to make syntax cleaner #76

Closed
andreichalapco opened this issue Mar 19, 2024 · 1 comment
Closed
Labels
enhancement New feature or request

Comments

@andreichalapco
Copy link

Describe the problem

Hi,
So i've used the generator for the ISO15118-2 and generate some messages. I immediately saw that within iso2_msgDefDatatypes.h there exists the following declarations for structs:

struct iso2_CostType {
    // costKind, costKindType (base: string)
    iso2_costKindType costKind;
    // amount, unsignedInt (base: unsignedLong)
    uint32_t amount;
    // amountMultiplier, unitMultiplierType (base: byte)
    int8_t amountMultiplier;
    unsigned int amountMultiplier_isUsed:1;
};

This syntax is clear for the declaration but a typedef declaration will make the use of this struct type more readable when implemented within other structs.
The idea is not to always usestruct name_type when used within other structs or function signatures.

Describe your solution

I can modify the generator if this is allowed to make a pull request if needed. The only problem with this change is: if this fix will trigger some global namespace problems (if enums with same name as structs exists, but I don't think so)

Additional context

No response

@andreichalapco andreichalapco added the enhancement New feature or request label Mar 19, 2024
@andreichalapco
Copy link
Author

Seems like a very used pattern ... my fault ... don't have a lot of experience in C.

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

No branches or pull requests

1 participant