Allow forward declaration of chibios hal structs
Posted: Tue Jun 22, 2021 10:33 am
Hi All,
This is a fairly simple request and I do not mind submitting a patch for it but I thought I would ask as it could be against a previous design decision.
I will use the SerialConfig as an example. Currently the structure is defined as:
This has the adverse effect that it cannot be forward declared. Instead the struct could look like the following:
This would allow for forward declaration as:
As far as I can tell, it would only be the definitions that need updating and the actual source code will remain the same.
This is useful when implementing pimpl and factory type patterns in C++.
This is a fairly simple request and I do not mind submitting a patch for it but I thought I would ask as it could be against a previous design decision.
I will use the SerialConfig as an example. Currently the structure is defined as:
Code: Select all
typedef struct
{
uint32_t speed;
...
} SerialConfig;
This has the adverse effect that it cannot be forward declared. Instead the struct could look like the following:
Code: Select all
typedef struct _SerialConfig
{
uint32_t speed;
...
} SerialConfig;
This would allow for forward declaration as:
Code: Select all
typedef struct _SerialConfig SerialConfig;
As far as I can tell, it would only be the definitions that need updating and the actual source code will remain the same.
This is useful when implementing pimpl and factory type patterns in C++.