[PATCH rtems-tools v1 4/7] TraceReaderLogQEMU.cc: Fix formatting
Ryan Long
ryan.long at oarcorp.com
Thu Sep 23 13:30:55 UTC 2021
Both of those definitions of discardBuff do the same thing. The form of value initializing in the example I showed was introduced in C++11. It was put in to zero out templated objects evidently. I just saw it on stackoverflow. :)
-----Original Message-----
From: Chris Johns <chrisj at rtems.org>
Sent: Wednesday, September 22, 2021 7:24 PM
To: Ryan Long <ryan.long at oarcorp.com>; devel at rtems.org
Subject: Re: [PATCH rtems-tools v1 4/7] TraceReaderLogQEMU.cc: Fix formatting
On 23/9/21 12:35 am, Ryan Long wrote:
> I changed the definition of discardBuff to
>
> char discardBuff[100]{};
char discardBuff[100] = {};
?
> So that every element will be initialized to \0. This function is only
> used in TraceReaderLogQEMU.cc, and the values that are passed in are
>
> #define QEMU_LOG_IN_KEY "IN: "
> #define QEMU_LOG_SECTION_END "----------------"
>
> Neither are close to going over the size of discardBuff, but I can add a check and return false if it does happen to go over that length.
Checking how the call is being used is cheating ... :)
Lets make the code robust and if someone makes a change and makes a mistake it is caught.
Chris
More information about the devel
mailing list