Right now i have a mixed version, but i am not sure of people want to like this style, so i wanted to ask you if this is a good and readable style.
// ABC = Library Namespace
// Preprocessor defines:
#define ABC_MY_DEFINE_X
// Constants
#define ABC_MY_CONSTANT 42
// Macros:
#define ABC_MyMacro(a, b)
// Custom types
#if !defined(abc_global)
#define abc_global static
#define abc_inline inline
#define abc_internal static
#endif
#if !defined(abc_u64)
typedef unsigned long long abc_u64;
...
#endif
// Structs
typedef struct abc_MyAwesomeStruct {
abc_u64 someValue;
} abc_MyAwesomeStruct;
// Enums
typedef enum abc_MySpecialType {
abc_MySpecialType_First,
abc_MySpecialType_Second,
abc_MySpecialType_Third,
} abc_MySpecialType;
// Inline functions
abc_inline abc_f32 abcSquaredF32(abc_f32 value) {
abc_f32 result = value * value;
return (result);
}
// Exported Functions
abc_extern void abcMyAwesomeFunction(abc_u32 x, abc_u32 whatever);
// Function for internal use only
abc_internal void __abcMyInternalFunction(abc_u32 x, abc_u32 *ptr);
// Global variables for internal use only
abc_global abc_u32 whatEverValue = 0;
Also i use custom typedefs for integer and decimal types, is this okay? or should i use Would be mapping the custom type to a stdint.h type a better way to go?
What i dont want is normal C naming conventions where everything except defines are lowercase + underscore.
Its so much nicer to read abcMyAwesomeFunction instead of abc_my_awesome_function.
I would use abc_MyAwesomeFunction, because its consistent to everything else.
What do you think?