Page 1 of 2
[RFC] Killing bool_t, TRUE, FALSE
Posted: Tue Feb 26, 2013 4:14 pm
by Giovanni
Hi,
This is probably late in the 2.5.x branch, I am thinking to replace bool_t, TRUE and FALSE with their C99 standard equivalents bool, true and false.
The idea is to remove this last "anomaly" from the code base.
Thoughts? do you foresee problems with this?
Giovanni
Re: [RFC] Killing bool_t, TRUE, FALSE
Posted: Tue Feb 26, 2013 4:23 pm
by Tectu
I don't see any problems coming with this. But wait! I don't want to say that this isn't any problem, I want to say that I don't have enough knowledge to know if issues could occure.
As far as I know, ChibiOS/RT (as well as ChibiOS/GFX) is currently c89 compatible, right? I wouldn't just replace this one thing.
Personally, I'd keep it like it is. But again, I don't have any technical reasons, just personal coding style preferences.
~ Tectu
Re: [RFC] Killing bool_t, TRUE, FALSE
Posted: Tue Feb 26, 2013 4:38 pm
by Giovanni
It is C89 and C99 compatible but when using C99 you have mixed definitions. The problem is that if you integrate ChibiOS with external libraries that use C99 you have this mix of bool_t, bool, false, TRUE etc in the application, ugly.
It is the same problem with integral types where at times you see u8, uint8, uint_8, u_8 uint8_t etc because authors don't even try to converge on the standard.
After the change it would be still C89 compatible by adding the C99 define/typedefs in chtypes.h for non-C99 compilers.
Giovanni
Re: [RFC] Killing bool_t, TRUE, FALSE
Posted: Thu Feb 28, 2013 7:32 pm
by Xamusk
Seems nice to use the C99 defaults and replace the defines for the C99 standard if using a C89 compiler.
Re: [RFC] Killing bool_t, TRUE, FALSE
Posted: Thu Feb 28, 2013 8:42 pm
by Tectu
Giovanni, if it's possible to compile without setting the C standard to c99 I am completely okay with that ^^
But again, it's really just personal preference and no technical reason at all.
~ Tectu
Re: [RFC] Killing bool_t, TRUE, FALSE
Posted: Thu Mar 14, 2013 12:19 am
by Dmytro
Personally I'm voting to kill bool_t and move forward. It's 2013 outside and no obvious reason to stick to c89.
If someones compiler is that old you still can add '#define true 1', etc.
Re: [RFC] Killing bool_t, TRUE, FALSE
Posted: Wed Mar 20, 2013 6:33 pm
by Badger
sounds like a sensible move. It is pretty obvious that bool is a type so no need for the _t prefix, and supporting modern compiler standards gets my vote.
Re: [RFC] Killing bool_t, TRUE, FALSE
Posted: Mon Apr 01, 2013 10:27 am
by barthess
Vote to move to C99.
Re: [RFC] Killing bool_t, TRUE, FALSE
Posted: Mon May 20, 2013 1:15 pm
by Tectu
Did this action now taken place? I don't really want to replace any bool_t, TRUE and FALSE in the GFX code but I started using the new ones in the new code that's being under development.
~ Tectu
Re: [RFC] Killing bool_t, TRUE, FALSE
Posted: Mon May 20, 2013 1:58 pm
by Giovanni
Hi,
I placed this in the "requirements" for ChibiOS 3.0.0:
http://www.chibios.org/dokuwiki/doku.ph ... _and_ideas2.6.0 is too close and better do not break things now considering that the next one is a huge step beyond.
Giovanni