We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Good:
enum RTC_TimeOfDay { RTC_TIMEOFDAY_MORN = 0, RTC_TIMEOFDAY_DAY, RTC_TIMEOFDAY_EVE, RTC_TIMEOFDAY_NITE, RTC_TIMEOFDAY_LATE, };
Bad:
typedef enum RTC_TimeOfDay { RTC_TIMEOFDAY_MORN = 0, RTC_TIMEOFDAY_DAY, RTC_TIMEOFDAY_EVE, RTC_TIMEOFDAY_NITE, RTC_TIMEOFDAY_LATE, } RTC_TimeOfDay;
Option 1: PascalCase
Option 2: alllowercase_t (similar to primitive non-unit typedefs) Note: Primitive unit typedefs are u8, u16, u32, s8, s16, s32 etc....
u8
u16
u32
s8
s16
s32
enum rtc_timeofday_t { RTC_TIMEOFDAY_MORN = 0, RTC_TIMEOFDAY_DAY, RTC_TIMEOFDAY_EVE, RTC_TIMEOFDAY_NITE, RTC_TIMEOFDAY_LATE, };
enum
enum RTC_TimeOfDay GF_RTC_GetTimeOfDay(void) { RTCTime time; GF_RTC_CopyTime(&time); return GF_RTC_GetTimeOfDayByHour(time.hour); }
enum rtc_timeofday_t GF_RTC_GetTimeOfDay(void) { RTCTime time; GF_RTC_CopyTime(&time); return GF_RTC_GetTimeOfDayByHour(time.hour); }
Bad (doesn't compile anyway):
RTC_TimeOfDay GF_RTC_GetTimeOfDay(void) { RTCTime time; GF_RTC_CopyTime(&time); return GF_RTC_GetTimeOfDayByHour(time.hour); }
rtc_timeofday_t GF_RTC_GetTimeOfDay(void) { RTCTime time; GF_RTC_CopyTime(&time); return GF_RTC_GetTimeOfDayByHour(time.hour); }
typedef enum rtc_timeofday_t { RTC_TIMEOFDAY_MORN = 0, RTC_TIMEOFDAY_DAY, RTC_TIMEOFDAY_EVE, RTC_TIMEOFDAY_NITE, RTC_TIMEOFDAY_LATE, } rtc_timeofday_t;
The text was updated successfully, but these errors were encountered:
this was actually agreed, I just havent updated the style guide yet, because im lazy and busy
do not typedef enums, refer explicitly to them, PascalCase
Sorry, something went wrong.
No typedef, PascalCase
This issue has had no activity for 60 days and will be marked stale. If there is no further activity, it will be closed in 30 days.
No branches or pull requests
There is no consensus whether enums are enums or typedefs.
Case 1: enums are enums, not typedefs
Do not typedef enums
Good:
Bad:
There is no consensus of the casing of enums (when enums are enums and not typedefs).
Option 1: PascalCase
Option 2: alllowercase_t (similar to primitive non-unit typedefs)
Note: Primitive unit typedefs are
u8
,u16
,u32
,s8
,s16
,s32
etc....Reference all enums with
enum
in code (this is forced anyway)Good:
Bad (doesn't compile anyway):
Case 2: enums are typedefs
Enum casing should be alllowercase_t
Good:
Bad:
Follow points 1, 2, and 3 of issue #212 (covers typedef struct naming) for the rest of the info
The text was updated successfully, but these errors were encountered: