[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: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

[RFC] Killing bool_t, TRUE, FALSE

Postby Giovanni » Tue Feb 26, 2013 4:14 pm

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: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: [RFC] Killing bool_t, TRUE, FALSE

Postby Tectu » Tue Feb 26, 2013 4:23 pm

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: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: [RFC] Killing bool_t, TRUE, FALSE

Postby Giovanni » Tue Feb 26, 2013 4:38 pm

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

Postby Xamusk » Thu Feb 28, 2013 7:32 pm

Seems nice to use the C99 defaults and replace the defines for the C99 standard if using a C89 compiler.

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: [RFC] Killing bool_t, TRUE, FALSE

Postby Tectu » Thu Feb 28, 2013 8:42 pm

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

Postby Dmytro » Thu Mar 14, 2013 12:19 am

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
Location: Bath, UK
Contact:

Re: [RFC] Killing bool_t, TRUE, FALSE

Postby Badger » Wed Mar 20, 2013 6:33 pm

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
Location: Minsk, Belarus
Been thanked: 7 times

Re: [RFC] Killing bool_t, TRUE, FALSE

Postby barthess » Mon Apr 01, 2013 10:27 am

Vote to move to C99.

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: [RFC] Killing bool_t, TRUE, FALSE

Postby Tectu » Mon May 20, 2013 1:15 pm

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: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: [RFC] Killing bool_t, TRUE, FALSE

Postby Giovanni » Mon May 20, 2013 1:58 pm

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


Return to “Development and Feedback”

Who is online

Users browsing this forum: No registered users and 17 guests