qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [Bug 1798659] Re: A typo in trace/simple.c


From: Thomas Huth
Subject: [Qemu-devel] [Bug 1798659] Re: A typo in trace/simple.c
Date: Fri, 19 Oct 2018 06:12:40 -0000

It's perfect valid C to terminate a statement with "," instead of ";" -
it just has a different meaning. Consider this:

#include <stdio.h>

int main()
{
    if (0)
        printf("Hello!\n"),
        
    printf("Good bye!\n");

    return 0;
}

At a first glance, you'd expect this program to print "Good bye!" - but
it does not. Actually, the "," is used here to put the two printf
statements into the same block, so this program is the same as:

    if (0) {
        printf("Hello!\n");
        printf("Good bye!\n");
    }

Thus, there is no real bug in simple.c here, but of course it would be
better style to clean this up and use ";" instead.

By the way, two lines earlier there is another line ending in ",":

    dropped.rec.event = DROPPED_EVENT_ID,

** Summary changed:

- A typo in trace/simple.c
+ Replace comma with semicolon in trace/simple.c

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1798659

Title:
  Replace comma with semicolon in trace/simple.c

Status in QEMU:
  New

Bug description:
  In the master branch in trace/simple.c in writeout_thread 
(https://github.com/qemu/qemu/blob/master/trace/simple.c#L174) we currently 
have:
    dropped.rec.length = sizeof(TraceRecord) + sizeof(uint64_t),
    dropped.rec.pid = trace_pid;

  It seems to me like a typo that the first line ends with a comma.
  Currently this causes no harm, but I think this should be fixed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1798659/+subscriptions



reply via email to

[Prev in Thread] Current Thread [Next in Thread]