Convert rtems-record-lttng program to C++

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Sep 2 05:09:35 UTC 2019


On 01/09/2019 04:46, Chris Johns wrote:
> On 31/8/19 5:29 am, Sebastian Huber wrote:
>> attached are two patches which convert the rtems-record-lttng client program from C to C++.
> 
> Is this a step to a full C++ app?

Yes, it is a step.

> 
> The following are some observations about the C++ piece of code...
> 
> Why in this code ..
> 
> +
> +#include <rtems/recordclient.h>
> +#include <rtems/recorddata.h>
> +
> +#include <assert.h>
> +#include <fcntl.h>
> +#include <sys/socket.h>
> +#include <sys/stat.h>
> +#include <unistd.h>
> +
> +#include <arpa/inet.h>
> +#include <netinet/in.h>
> +
> +#include <csignal>
> +#include <cstring>
> +
> +#ifndef RTEMS_TOOLS_TRACE_RECORD_CLIENT_H_
> +#define RTEMS_TOOLS_TRACE_RECORD_CLIENT_H_
> +
> 
> are the includes not protected as well? 

Hm, this was not intentional. I hope the formatter didn't cause this. I 
have to check that.

> I think the inlines in Client are too
> big and would be better in a .cc or .cpp file.

Is it worth doing this? All the code ends up in a main().

> Why use an assert when you can
> throw an exception?

Yes, this is the next step. The client.h is more or less a copy and 
paste from the record-main-lttng.cc.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list