[PATCH] rtems-utils: Change data type definition

Chris Johns chrisj at rtems.org
Thu Jul 29 23:06:42 UTC 2021


Why not use the namespace explicitly and avoid this shortening? Namespaces are
there to help.

With C++ I have a simple rule which is always use the namespace path where
possible. There are a few cases, for example in a class, a function or local
block where using an alias helps the formatting otherwise I avoid doing this.

I have found shortening like this can create churn in more complex cases where
the number of cases grows and the potential for clashes rises requiring some
pieces to change and that results in churn. In this case I need to remember the
local `ostream_guard` is actually the standard one and not something special
rather than just knowing this by reading it and in the more complex cases I need
to remember more and more mappings to understand the code.

Chris

On 29/7/21 11:34 pm, Ryan Long wrote:
> Change typedef for ostream_guard to using.
> ---
>  linkers/rtems-exeinfo.cpp        | 2 +-
>  tester/covoar/CoverageMapBase.cc | 2 +-
>  tester/covoar/ReportsHtml.cc     | 2 +-
>  tester/covoar/ReportsText.cc     | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/linkers/rtems-exeinfo.cpp b/linkers/rtems-exeinfo.cpp
> index c9bf5b6..faa98a2 100644
> --- a/linkers/rtems-exeinfo.cpp
> +++ b/linkers/rtems-exeinfo.cpp
> @@ -53,7 +53,7 @@
>  #define kill(p,s) raise(s)
>  #endif
>  
> -typedef rtems::utils::ostream_guard ostream_guard;
> +using ostream_guard = rtems::utils::ostream_guard;
>  
>  namespace rld
>  {
> diff --git a/tester/covoar/CoverageMapBase.cc b/tester/covoar/CoverageMapBase.cc
> index 4de9307..9966f73 100644
> --- a/tester/covoar/CoverageMapBase.cc
> +++ b/tester/covoar/CoverageMapBase.cc
> @@ -16,7 +16,7 @@
>  
>  #include "CoverageMapBase.h"
>  
> -typedef rtems::utils::ostream_guard ostream_guard;
> +using ostream_guard = rtems::utils::ostream_guard;
>  
>  namespace Coverage {
>  
> diff --git a/tester/covoar/ReportsHtml.cc b/tester/covoar/ReportsHtml.cc
> index e276732..d68efd4 100644
> --- a/tester/covoar/ReportsHtml.cc
> +++ b/tester/covoar/ReportsHtml.cc
> @@ -14,7 +14,7 @@
>  #include "DesiredSymbols.h"
>  #include "ObjdumpProcessor.h"
>  
> -typedef rtems::utils::ostream_guard ostream_guard;
> +using ostream_guard = rtems::utils::ostream_guard;
>  
>  #if 0
>  #define TABLE_HEADER_CLASS \
> diff --git a/tester/covoar/ReportsText.cc b/tester/covoar/ReportsText.cc
> index c4a5dbc..aba7e51 100644
> --- a/tester/covoar/ReportsText.cc
> +++ b/tester/covoar/ReportsText.cc
> @@ -12,7 +12,7 @@
>  
>  #include <rtems-utils.h>
>  
> -typedef rtems::utils::ostream_guard ostream_guard;
> +using ostream_guard = rtems::utils::ostream_guard;
>  
>  namespace Coverage {
>  
> 


More information about the devel mailing list