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 <chr...@rtems.org> Sent: Wednesday, September 22, 2021 7:24 PM To: Ryan Long <ryan.l...@oarcorp.com>; devel@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 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel