[PATCH] score: Use defines for Thread_Life_state

Peter Dufault dufault at hda.com
Fri Jan 29 17:33:56 UTC 2021



> On Jan 29, 2021, at 11:37 , Gedare Bloom <gedare at rtems.org> wrote:
> 
> On Fri, Jan 29, 2021 at 9:03 AM Sebastian Huber <sebastian.huber at embedded-brains.de> wrote:
> On 29/01/2021 16:09, Joel Sherrill wrote:
> 
> > On Fri, Jan 29, 2021 at 9:06 AM Gedare Bloom <gedare at rtems.org
> > <mailto:gedare at rtems.org>> wrote:
> >
> >
> >
> >     On Fri, Jan 29, 2021 at 12:24 AM Sebastian Huber
> >     <sebastian.huber at embedded-brains.de
> >     <mailto:sebastian.huber at embedded-brains.de>> wrote:
> >
> >         Do not use an enum as a bit field.  Document the state flags.
> >
> >
> > Is this a new style rule that needs to be documented?
> 
> Into which category would you put this? Language and Compiler?
> 
> https://docs.rtems.org/branches/master/eng/coding-conventions.html
> 
> 
> Yes.
> 
> 
I use enums as bit fields a lot. I use them in conjunction with objects that are the same enum.

I avoid using #define.  In most situations you can't print them in a debugger and they imply restricted usage.

Is this an appropriate warning?  Does it always mean that the enum should be replaced with a #define?

If it doesn't always apply then the style should make it clear when it should apply.

Peter
-----------------
Peter Dufault
HD Associates, Inc.      Software and System Engineering

This email is delivered through the public internet using protocols subject to interception and tampering.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.rtems.org/pipermail/devel/attachments/20210129/03e5e396/attachment.bin>


More information about the devel mailing list