Skip to content

Latest commit

 

History

History
31 lines (23 loc) · 1.16 KB

File metadata and controls

31 lines (23 loc) · 1.16 KB

Contributing to Project Guidelines

Coding Style

The majority of the code in this repository adheres to Google's C++ guidelines. Below are additional rules which we adhere to:

1. C Struct intialisation

If you're initialising a struct, please use member designators to identify the individual fields:

iota_stor_pack_t pack = {.models = (void **)txs,
                         .capacity = 5,
                         .num_loaded = 0,
                         .insufficient_capacity = false};

You can find more information on the capabilities of C99 in this regard here.

2. Put function prototypes inside an extern "C" block

When writing a header file in C, put function prototypes inside an extern "C" block like this:

#ifdef __cplusplus
extern "C" {
#endif

#ifdef __cplusplus
}
#endif

It will avoid having function symbols mangled leading to linkage errors when used in a C++ project. You can find more information about this here.