Back Midas Rome Roody Rootana
  Midas DAQ System  Not logged in ELOG logo
Entry  22 Jun 2024, Joseph McKenna, Suggestion, manalyzer thread safety and custom http IP binding 
    Reply  05 Jul 2024, Joseph McKenna, Suggestion, shared pointers for more flexible memory managment of the analysis 'flow' and TMEvent 
       Reply  05 Jul 2024, Joseph McKenna, Suggestion, Clean up compiler warning in manalyzer 
          Reply  13 Sep 2024, Konstantin Olchanski, Suggestion, Clean up compiler warning in manalyzer 
             Reply  20 Sep 2024, Joseph McKenna, Suggestion, Clean up compiler warning in manalyzer 
                Reply  20 Sep 2024, Stefan Ritt, Suggestion, Clean up compiler warning in manalyzer 
                   Reply  24 Sep 2024, Konstantin Olchanski, Suggestion, Clean up compiler warning in manalyzer 
    Reply  13 Sep 2024, Konstantin Olchanski, Suggestion, manalyzer thread safety and custom http IP binding 
Message ID: 2859     Entry time: 24 Sep 2024     In reply to: 2855
Author: Konstantin Olchanski 
Topic: Suggestion 
Subject: Clean up compiler warning in manalyzer 
> > I like the look of std::format, looks cleaner than string streams
> 
> I fully agree. String streams is a pain if you want to do zero-leading hex output mixed with decimal output. Yes it's easier to read if you don't know printf syntax,
> but 10-20 times more chars to write and not necessarily cleaner.
>

IMO c++ string streams formatting is optimized for "hello world" and is useless for printing hex numbers, table-formatted data and generally anything real-life.

plus the borked std::to_string() (it takes a global lock for the "C" locale), "fixed" it by introducing std::to_chars() in C++17,
with "ultimate fix" in std::format in C++26.

no question why C++ has the bad reputation. for a "done right" example, take a look at the Go standard library.

> 
> Probable is that we would have to convert about a few thousand of sprintf's() in midas.
> 

surprising few bare sprintf() remaining in MIDAS, most of them overflow-safe and most of them to be converted to msprintf().

K.O.
ELOG V3.1.4-2e1708b5