[RFC] Killing bool_t, TRUE, FALSE

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

[RFC] Killing bool_t, TRUE, FALSE

Post 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
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

Re: [RFC] Killing bool_t, TRUE, FALSE

Post 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
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: [RFC] Killing bool_t, TRUE, FALSE

Post 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
Xamusk
Posts: 81
Joined: Sat Mar 05, 2011 10:47 pm

Re: [RFC] Killing bool_t, TRUE, FALSE

Post by Xamusk »

Seems nice to use the C99 defaults and replace the defines for the C99 standard if using a C89 compiler.
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

Re: [RFC] Killing bool_t, TRUE, FALSE

Post 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
Dmytro
Posts: 98
Joined: Sun Oct 07, 2012 11:49 am

Re: [RFC] Killing bool_t, TRUE, FALSE

Post 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.
User avatar
Badger
Posts: 346
Joined: Mon Apr 18, 2011 6:07 pm

Re: [RFC] Killing bool_t, TRUE, FALSE

Post 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.
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: [RFC] Killing bool_t, TRUE, FALSE

Post by barthess »

Vote to move to C99.
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

Re: [RFC] Killing bool_t, TRUE, FALSE

Post 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
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: [RFC] Killing bool_t, TRUE, FALSE

Post by Giovanni »

Hi,

I placed this in the "requirements" for ChibiOS 3.0.0: http://www.chibios.org/dokuwiki/doku.ph ... _and_ideas

2.6.0 is too close and better do not break things now considering that the next one is a huge step beyond.

Giovanni
Post Reply