Open JacobChrist opened 8 years ago
It's a typical Microchipism
On Tue, 22 Nov 2016 00:40 Jacob Christ, notifications@github.com wrote:
Does anyone else find this typedef in Deeprom.h to be strange
typedef uint32_t BOOL;
Its especially strange to me be because stdint.h is included in this file before this typedef.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/chipKIT32/chipKIT-core/issues/306, or mute the thread https://github.com/notifications/unsubscribe-auth/ADouHGh31MHed-vztNsWMkbzZ0hvqRNIks5rAjn2gaJpZM4K44Ax .
Matt Jenkins Majenko Technologies http://stores.ebay.co.uk/Majenko-Technologies
Do you know if it serves any purpose other than upsetting my obsessive compulsive disorder to remove unnecessary code?
It does the same to me. Much Microchip code us littered with such idiotic typedefs.
The whole thing blows up if you take it out... seems like a problem for another day.
I see what's going on here.. Its been too long since I touch c/c++.. I was confusing the order of the type being defined and what is already defined. This is creating a BOOL type out of a uint32_t which comes from stdint.h. I was thinking it was the other way around. I am less concerned now but wonder if this is the best way to pick up the BOOL type?
It's A way, certainly. Since there is no such thing really as a bool in c (there is in c++) crazy things get invented. I hate all-caps type names. They are loathsome.
Normally you'd just #include
Jacob, if there is more to discuss here with regards to the strange typedef you found, please continue the discussion. Otherwise I think you can close this issue.
This can probably be closed. But Matt brought up a good point. Should we use BOOL or bool? In spite of what is probably the more elegant code we should probably ask WWAD? What would Arduino Do for maximum compatibility.
On Nov 27, 2016 6:56 PM, "Brian Schmalz" notifications@github.com wrote:
Jacob, if there is more to discuss here with regards to the strange typedef you found, please continue the discussion. Otherwise I think you can close this issue.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/chipKIT32/chipKIT-core/issues/306#issuecomment-263172641, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMGa7_WfmLnL7XgwmIsD-VV6pShtTNyks5rCkLcgaJpZM4K44Ax .
WWAD? They'd use boolean
- which is what Java uses (and be incompatible with everyone else in the community). bool
is what we should be using. It's the standard, and programs like vim
highlight it properly, which they don't with BOOL
and boolean
.
Agreed. BOOL (as well as things like INT8) are Microchip special defines. We should be sticking the standards in stdint.h and stdbool.h.
*Brian
On Fri, Feb 16, 2018 at 9:06 AM, Majenko Technologies < notifications@github.com> wrote:
WWAD? They'd use boolean - which is what Java uses (and be incompatible with everyone else in the community). bool is what we should be using. It's the standard, and programs like vim highlight it properly, which they don't with BOOL and boolean.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/chipKIT32/chipKIT-core/issues/306#issuecomment-366260299, or mute the thread https://github.com/notifications/unsubscribe-auth/AAbeCHymfO5L-VOeenZr8N6pZk6CZhZ4ks5tVZlugaJpZM4K44Ax .
Maybe we should set out a standard coding style document that all commits to the core must conform to? That would annoy Digilent ;)
Things like:
int8_t
, int16_t
, int32_t
, uint8_t
, uint16_t
, uint32_t
bool
... etc ...
Yes, these should be our standards, and we should do our best to enforce them on PRs. I don't believe it going back and re-writing existing code just for coding standards like this, but as we update things . . .
*Brian
On Fri, Feb 16, 2018 at 10:20 AM, Majenko Technologies < notifications@github.com> wrote:
Maybe we should set out a standard coding style document that all commits to the core must conform to? That would annoy Digilent ;)
Things like:
- Only use stdint.h integers: int8_t, int16_t, int32_t, uint8_t, uint16_t, uint32_t
- Only use stdbool.h's bool
- Always use camelCase for variable and function names
- Always use UpperWordCase for class, type and struct names
... etc ...
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/chipKIT32/chipKIT-core/issues/306#issuecomment-366282592, or mute the thread https://github.com/notifications/unsubscribe-auth/AAbeCFMaq_DxUdCu7j5NuD-aNuXl-ubFks5tVarLgaJpZM4K44Ax .
These all sound fair. But we should probably have a define for boolean for compatibility if it doesn't already exist.
Jacob
Jacob Christ ProLinear/PONTECH, Inc. +1 (909) 652-0670 Phone http://www.pontech.com
On Fri, Feb 16, 2018 at 8:40 AM, Brian Schmalz notifications@github.com wrote:
Yes, these should be our standards, and we should do our best to enforce them on PRs. I don't believe it going back and re-writing existing code just for coding standards like this, but as we update things . . .
*Brian
On Fri, Feb 16, 2018 at 10:20 AM, Majenko Technologies < notifications@github.com> wrote:
Maybe we should set out a standard coding style document that all commits to the core must conform to? That would annoy Digilent ;)
Things like:
- Only use stdint.h integers: int8_t, int16_t, int32_t, uint8_t, uint16_t, uint32_t
- Only use stdbool.h's bool
- Always use camelCase for variable and function names
- Always use UpperWordCase for class, type and struct names
... etc ...
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/chipKIT32/chipKIT-core/issues/306# issuecomment-366282592, or mute the thread https://github.com/notifications/unsubscribe- auth/AAbeCFMaq_DxUdCu7j5NuD-aNuXl-ubFks5tVarLgaJpZM4K44Ax
.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/chipKIT32/chipKIT-core/issues/306#issuecomment-366288694, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMGa7Y6mklnAOxlj4bTGURifs61NWpkks5tVa-TgaJpZM4K44Ax .
Boolean is in the core. Ardueenies use it all the time.
So, @majenkotech and @JacobChrist , what's the best way to move forward with this issue so we can close it?
Should I do a wholesale replacement of BOOL in all core and libraries with bool?
I think we should go for maximum compatibility with c standards without sacrificing Arduino compatibility. For this instance I think boil would get us closer to c standard libs w/o changing and Arduino compatibility, though not necessarily improving Arduino compatibility.
Jacob
On Sat, Mar 24, 2018, 11:08 AM Brian Schmalz notifications@github.com wrote:
So, @majenkotech https://github.com/majenkotech and @JacobChrist https://github.com/JacobChrist , what's the best way to move forward with this issue so we can close it?
Should I do a wholesale replacement of BOOL in all core and libraries with bool?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/chipKIT32/chipKIT-core/issues/306#issuecomment-375913115, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMGa_XfpLxQh6J-EZQ1rrNSaOPunJk7ks5thouHgaJpZM4K44Ax .
Does anyone else find this typedef in Deeprom.h to be strange
Its especially strange to me be because stdint.h is included in this file before this typedef.