On Fri, Sep 25, 2020 at 10:21 AM Sebastian Huber
<sebastian.hu...@embedded-brains.de> wrote:
>
> On 25/09/2020 17:42, Joel Sherrill wrote:
>
> >     diff --git a/cpukit/libmisc/monitor/mon-queue.c
> >     b/cpukit/libmisc/monitor/mon-queue.c
> >     index 9430797c6c..aadfcd3989 100644
> >     --- a/cpukit/libmisc/monitor/mon-queue.c
> >     +++ b/cpukit/libmisc/monitor/mon-queue.c
> >     @@ -16,7 +16,21 @@ rtems_monitor_queue_canonical(
> >      {
> >          const Message_queue_Control *rtems_queue = (const
> >     Message_queue_Control *) queue_void;
> >
> >     -    canonical_queue->attributes = rtems_queue->attribute_set;
> >     +    canonical_queue->attributes = 0;
> >     +
> >     +    if (
> >     +      rtems_queue->message_queue.operations
> >     +        == &_Thread_queue_Operations_priority
> >     +    ) {
> >
> >
> > Why the odd formatting on this? I would think it should be:
> >    if ( rtems_queue->message_queue.operations ==
> >           &_Thread_queue_Operations_priority ) {
> With this style it is not really clear what belongs to the condition and
> what to the next code block. The ") {" in a separate line makes this
> more clear.
>
The formatting from Sebastian is correct/acceptable. We don't exactly
specify whether the == should go on the same line or separate. But if
you break a conditional, it is supposed to be throughout the whole
thing like that
if (
  ... first line
  ...
  ... last line
) {
> I used this style all over the place for a couple of years.
> Unfortunately, this area is not covered by the coding conventions:
>
> https://docs.rtems.org/branches/master/eng/coding-conventions.html#formatting
>
Yes, I think this came up recently about whether to put the
(in)equality check on the same or next line. Either way seems to be
ok. We don't have an example to cover this choice:
https://docs.rtems.org/branches/master/eng/coding-80cols.html

> _______________________________________________
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to