Hi,
Are there any objections against adding 'long' as standard RTT type?
Markus
>From 81ceb191e43c1e5bc15b089edf53384b565cf08b Mon Sep 17 00:00:00 2001
From: Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
Date: Thu, 9 Jun 2011 10:47:18 +0200
Subject: [PATCH] add long to rtt typekit
---
rtt/typekit/RealTimeTypekitTypes.cpp | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/rtt/typekit/RealTimeTypekitTypes.cpp b/rtt/typekit/RealTimeTypekitTypes.cpp
index 5730799..5091033 100644
--- a/rtt/typekit/RealTimeTypekitTypes.cpp
+++ b/rtt/typekit/RealTimeTypekitTypes.cpp
@@ -67,6 +67,7 @@ namespace RTT
ti->addType( new StdTypeInfo<double>("double") );
ti->addType( new StdTypeInfo<float>("float") );
ti->addType( new StdTypeInfo<char>("char") );
+ ti->addType( new StdTypeInfo<long>("long") );
ti->addType( new BoolTypeInfo() );
ti->addType( new TypeInfoName<void>("void"));
adding 'long' as basic RTT type
On Thursday 09 June 2011 10:47:59 Markus Klotzbuecher wrote:
> Hi,
>
> Are there any objections against adding 'long' as standard RTT type?
>
> Markus
>
> >From 81ceb191e43c1e5bc15b089edf53384b565cf08b Mon Sep 17 00:00:00 2001
>
> From: Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
> Date: Thu, 9 Jun 2011 10:47:18 +0200
> Subject: [PATCH] add long to rtt typekit
>
> ---
> rtt/typekit/RealTimeTypekitTypes.cpp | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/rtt/typekit/RealTimeTypekitTypes.cpp
> b/rtt/typekit/RealTimeTypekitTypes.cpp index 5730799..5091033 100644
> --- a/rtt/typekit/RealTimeTypekitTypes.cpp
> +++ b/rtt/typekit/RealTimeTypekitTypes.cpp
> @@ -67,6 +67,7 @@ namespace RTT
> ti->addType( new StdTypeInfo<double>("double") );
> ti->addType( new StdTypeInfo<float>("float") );
> ti->addType( new StdTypeInfo<char>("char") );
> + ti->addType( new StdTypeInfo<long>("long") );
> ti->addType( new BoolTypeInfo() );
> ti->addType( new TypeInfoName<void>("void"));
I think C++ maps long to int. So if you do this, it will just replace/alias
the int type.
I'd prefer to improve/fix the aliasType() function in the 'ti' such that you
could write:
ti->addTypeAlias("int","long")
Peter
adding 'long' as basic RTT type
On Thu, Jun 09, 2011 at 03:25:37PM +0200, Peter Soetens wrote:
> On Thursday 09 June 2011 10:47:59 Markus Klotzbuecher wrote:
> > Hi,
> >
> > Are there any objections against adding 'long' as standard RTT type?
> >
> > Markus
> >
> > >From 81ceb191e43c1e5bc15b089edf53384b565cf08b Mon Sep 17 00:00:00 2001
> >
> > From: Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
> > Date: Thu, 9 Jun 2011 10:47:18 +0200
> > Subject: [PATCH] add long to rtt typekit
> >
> > ---
> > rtt/typekit/RealTimeTypekitTypes.cpp | 1 +
> > 1 files changed, 1 insertions(+), 0 deletions(-)
> >
> > diff --git a/rtt/typekit/RealTimeTypekitTypes.cpp
> > b/rtt/typekit/RealTimeTypekitTypes.cpp index 5730799..5091033 100644
> > --- a/rtt/typekit/RealTimeTypekitTypes.cpp
> > +++ b/rtt/typekit/RealTimeTypekitTypes.cpp
> > @@ -67,6 +67,7 @@ namespace RTT
> > ti->addType( new StdTypeInfo<double>("double") );
> > ti->addType( new StdTypeInfo<float>("float") );
> > ti->addType( new StdTypeInfo<char>("char") );
> > + ti->addType( new StdTypeInfo<long>("long") );
> > ti->addType( new BoolTypeInfo() );
> > ti->addType( new TypeInfoName<void>("void"));
>
> I think C++ maps long to int. So if you do this, it will just replace/alias
> the int type.
No, not necessarily. On my 64bit platform long is 8 bytes and int is
4. On 32bit they will probably be the same.
> I'd prefer to improve/fix the aliasType() function in the 'ti' such that you
> could write:
>
> ti->addTypeAlias("int","long")
That will not do the right thing in all cases.
Markus
adding 'long' as basic RTT type
On Fri, 10 Jun 2011, Markus Klotzbuecher wrote:
> On Thu, Jun 09, 2011 at 03:25:37PM +0200, Peter Soetens wrote:
>> On Thursday 09 June 2011 10:47:59 Markus Klotzbuecher wrote:
>>> Hi,
>>>
>>> Are there any objections against adding 'long' as standard RTT type?
>>>
>>> Markus
>>>
>>>> From 81ceb191e43c1e5bc15b089edf53384b565cf08b Mon Sep 17 00:00:00 2001
>>>
>>> From: Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
>>> Date: Thu, 9 Jun 2011 10:47:18 +0200
>>> Subject: [PATCH] add long to rtt typekit
>>>
>>> ---
>>> rtt/typekit/RealTimeTypekitTypes.cpp | 1 +
>>> 1 files changed, 1 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/rtt/typekit/RealTimeTypekitTypes.cpp
>>> b/rtt/typekit/RealTimeTypekitTypes.cpp index 5730799..5091033 100644
>>> --- a/rtt/typekit/RealTimeTypekitTypes.cpp
>>> +++ b/rtt/typekit/RealTimeTypekitTypes.cpp
>>> @@ -67,6 +67,7 @@ namespace RTT
>>> ti->addType( new StdTypeInfo<double>("double") );
>>> ti->addType( new StdTypeInfo<float>("float") );
>>> ti->addType( new StdTypeInfo<char>("char") );
>>> + ti->addType( new StdTypeInfo<long>("long") );
>>> ti->addType( new BoolTypeInfo() );
>>> ti->addType( new TypeInfoName<void>("void"));
>>
>> I think C++ maps long to int. So if you do this, it will just replace/alias
>> the int type.
>
> No, not necessarily. On my 64bit platform long is 8 bytes and int is
> 4. On 32bit they will probably be the same.
>
So, this seems to be a pandora box for (actual as well as later)
interoperability problems...
>> I'd prefer to improve/fix the aliasType() function in the 'ti' such that you
>> could write:
>>
>> ti->addTypeAlias("int","long")
>
> That will not do the right thing in all cases.
>
> Markus
Herman
adding 'long' as basic RTT type
On Fri, Jun 10, 2011 at 09:02:44AM +0200, Herman Bruyninckx wrote:
> On Fri, 10 Jun 2011, Markus Klotzbuecher wrote:
>
> > On Thu, Jun 09, 2011 at 03:25:37PM +0200, Peter Soetens wrote:
> >> On Thursday 09 June 2011 10:47:59 Markus Klotzbuecher wrote:
> >>> Hi,
> >>>
> >>> Are there any objections against adding 'long' as standard RTT type?
> >>>
> >>> Markus
> >>>
> >>>> From 81ceb191e43c1e5bc15b089edf53384b565cf08b Mon Sep 17 00:00:00 2001
> >>>
> >>> From: Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
> >>> Date: Thu, 9 Jun 2011 10:47:18 +0200
> >>> Subject: [PATCH] add long to rtt typekit
> >>>
> >>> ---
> >>> rtt/typekit/RealTimeTypekitTypes.cpp | 1 +
> >>> 1 files changed, 1 insertions(+), 0 deletions(-)
> >>>
> >>> diff --git a/rtt/typekit/RealTimeTypekitTypes.cpp
> >>> b/rtt/typekit/RealTimeTypekitTypes.cpp index 5730799..5091033 100644
> >>> --- a/rtt/typekit/RealTimeTypekitTypes.cpp
> >>> +++ b/rtt/typekit/RealTimeTypekitTypes.cpp
> >>> @@ -67,6 +67,7 @@ namespace RTT
> >>> ti->addType( new StdTypeInfo<double>("double") );
> >>> ti->addType( new StdTypeInfo<float>("float") );
> >>> ti->addType( new StdTypeInfo<char>("char") );
> >>> + ti->addType( new StdTypeInfo<long>("long") );
> >>> ti->addType( new BoolTypeInfo() );
> >>> ti->addType( new TypeInfoName<void>("void"));
> >>
> >> I think C++ maps long to int. So if you do this, it will just replace/alias
> >> the int type.
> >
> > No, not necessarily. On my 64bit platform long is 8 bytes and int is
> > 4. On 32bit they will probably be the same.
> >
> So, this seems to be a pandora box for (actual as well as later)
> interoperability problems...
It depends: sometimes you need the size of the integer to grow with
your platforms native size, at others your application requires a
fixed size.
Markus
adding 'long' as basic RTT type
On Friday 10 June 2011 09:07:17 Markus Klotzbuecher wrote:
> On Fri, Jun 10, 2011 at 09:02:44AM +0200, Herman Bruyninckx wrote:
> > On Fri, 10 Jun 2011, Markus Klotzbuecher wrote:
> > > On Thu, Jun 09, 2011 at 03:25:37PM +0200, Peter Soetens wrote:
> > >> On Thursday 09 June 2011 10:47:59 Markus Klotzbuecher wrote:
> > >>> Hi,
> > >>>
> > >>> Are there any objections against adding 'long' as standard RTT type?
> > >>>
> > >>> Markus
> > >>>
> > >>>> From 81ceb191e43c1e5bc15b089edf53384b565cf08b Mon Sep 17 00:00:00
> > >>>> 2001
> > >>>
> > >>> From: Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
> > >>> Date: Thu, 9 Jun 2011 10:47:18 +0200
> > >>> Subject: [PATCH] add long to rtt typekit
> > >>>
> > >>> ---
> > >>>
> > >>> rtt/typekit/RealTimeTypekitTypes.cpp | 1 +
> > >>> 1 files changed, 1 insertions(+), 0 deletions(-)
> > >>>
> > >>> diff --git a/rtt/typekit/RealTimeTypekitTypes.cpp
> > >>> b/rtt/typekit/RealTimeTypekitTypes.cpp index 5730799..5091033 100644
> > >>> --- a/rtt/typekit/RealTimeTypekitTypes.cpp
> > >>> +++ b/rtt/typekit/RealTimeTypekitTypes.cpp
> > >>> @@ -67,6 +67,7 @@ namespace RTT
> > >>>
> > >>> ti->addType( new StdTypeInfo<double>("double") );
> > >>> ti->addType( new StdTypeInfo<float>("float") );
> > >>> ti->addType( new StdTypeInfo<char>("char") );
> > >>>
> > >>> + ti->addType( new StdTypeInfo<long>("long") );
> > >>>
> > >>> ti->addType( new BoolTypeInfo() );
> > >>> ti->addType( new TypeInfoName<void>("void"));
> > >>
> > >> I think C++ maps long to int. So if you do this, it will just
> > >> replace/alias the int type.
> > >
> > > No, not necessarily. On my 64bit platform long is 8 bytes and int is
> > > 4. On 32bit they will probably be the same.
> >
> > So, this seems to be a pandora box for (actual as well as later)
> > interoperability problems...
>
> It depends: sometimes you need the size of the integer to grow with
> your platforms native size, at others your application requires a
> fixed size.
For these cases, I would recommend using size_t, but that will be unsigned...
Anyway, for literally adding long, the line you suggest will then be ok for
both 32/64bit (the aliasing will be done by RTT if necessary), but you'll also
have to define all the conversions from long to int to bool etc.
Peter
adding 'long' as basic RTT type
On 10/06/2011 09:33, Peter Soetens wrote:
> On Friday 10 June 2011 09:07:17 Markus Klotzbuecher wrote:
>> On Fri, Jun 10, 2011 at 09:02:44AM +0200, Herman Bruyninckx wrote:
>>> On Fri, 10 Jun 2011, Markus Klotzbuecher wrote:
>>>> On Thu, Jun 09, 2011 at 03:25:37PM +0200, Peter Soetens wrote:
>>>>> On Thursday 09 June 2011 10:47:59 Markus Klotzbuecher wrote:
>>>>>> Hi,
>>>>>>
>>>>>> Are there any objections against adding 'long' as standard RTT type?
>>>>>>
>>>>>> Markus
>>>>>>
>>>>>>> From 81ceb191e43c1e5bc15b089edf53384b565cf08b Mon Sep 17 00:00:00
>>>>>>> 2001
>>>>>> From: Markus Klotzbuecher<markus [dot] klotzbuecher [..] ...>
>>>>>> Date: Thu, 9 Jun 2011 10:47:18 +0200
>>>>>> Subject: [PATCH] add long to rtt typekit
>>>>>>
>>>>>> ---
>>>>>>
>>>>>> rtt/typekit/RealTimeTypekitTypes.cpp | 1 +
>>>>>> 1 files changed, 1 insertions(+), 0 deletions(-)
>>>>>>
>>>>>> diff --git a/rtt/typekit/RealTimeTypekitTypes.cpp
>>>>>> b/rtt/typekit/RealTimeTypekitTypes.cpp index 5730799..5091033 100644
>>>>>> --- a/rtt/typekit/RealTimeTypekitTypes.cpp
>>>>>> +++ b/rtt/typekit/RealTimeTypekitTypes.cpp
>>>>>> @@ -67,6 +67,7 @@ namespace RTT
>>>>>>
>>>>>> ti->addType( new StdTypeInfo<double>("double") );
>>>>>> ti->addType( new StdTypeInfo<float>("float") );
>>>>>> ti->addType( new StdTypeInfo<char>("char") );
>>>>>>
>>>>>> + ti->addType( new StdTypeInfo<long>("long") );
>>>>>>
>>>>>> ti->addType( new BoolTypeInfo() );
>>>>>> ti->addType( new TypeInfoName<void>("void"));
>>>>> I think C++ maps long to int. So if you do this, it will just
>>>>> replace/alias the int type.
>>>> No, not necessarily. On my 64bit platform long is 8 bytes and int is
>>>> 4. On 32bit they will probably be the same.
>>> So, this seems to be a pandora box for (actual as well as later)
>>> interoperability problems...
>> It depends: sometimes you need the size of the integer to grow with
>> your platforms native size, at others your application requires a
>> fixed size.
> For these cases, I would recommend using size_t, but that will be unsigned...
>
> Anyway, for literally adding long, the line you suggest will then be ok for
> both 32/64bit (the aliasing will be done by RTT if necessary), but you'll also
> have to define all the conversions from long to int to bool etc.
>
> Peter
A solution could be to use types that explicitely give the corresponding
bit size.
Such as the Google coding style suggests:
"Of the built-in C++ integer types, the only one used is |int|. If a
program needs a variable of a different size, use a precise-width
integer type from |<stdint.h>|, such as |int16_t|."
from
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Integer_T...
Charles.
adding 'long' as basic RTT type
On Jun 10, 2011, at 03:39 , Charles Lesire-Cabaniols wrote:
> On 10/06/2011 09:33, Peter Soetens wrote:
>>
>> On Friday 10 June 2011 09:07:17 Markus Klotzbuecher wrote:
>>> On Fri, Jun 10, 2011 at 09:02:44AM +0200, Herman Bruyninckx wrote:
>>>> On Fri, 10 Jun 2011, Markus Klotzbuecher wrote:
>>>>> On Thu, Jun 09, 2011 at 03:25:37PM +0200, Peter Soetens wrote:
>>>>>> On Thursday 09 June 2011 10:47:59 Markus Klotzbuecher wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> Are there any objections against adding 'long' as standard RTT type?
>>>>>>>
>>>>>>> Markus
>>>>>>>
>>>>>>>> From 81ceb191e43c1e5bc15b089edf53384b565cf08b Mon Sep 17 00:00:00
>>>>>>>> 2001
>>>>>>> From: Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
>>>>>>> Date: Thu, 9 Jun 2011 10:47:18 +0200
>>>>>>> Subject: [PATCH] add long to rtt typekit
>>>>>>>
>>>>>>> ---
>>>>>>>
>>>>>>> rtt/typekit/RealTimeTypekitTypes.cpp | 1 +
>>>>>>> 1 files changed, 1 insertions(+), 0 deletions(-)
>>>>>>>
>>>>>>> diff --git a/rtt/typekit/RealTimeTypekitTypes.cpp
>>>>>>> b/rtt/typekit/RealTimeTypekitTypes.cpp index 5730799..5091033 100644
>>>>>>> --- a/rtt/typekit/RealTimeTypekitTypes.cpp
>>>>>>> +++ b/rtt/typekit/RealTimeTypekitTypes.cpp
>>>>>>> @@ -67,6 +67,7 @@ namespace RTT
>>>>>>>
>>>>>>> ti->addType( new StdTypeInfo<double>("double") );
>>>>>>> ti->addType( new StdTypeInfo<float>("float") );
>>>>>>> ti->addType( new StdTypeInfo<char>("char") );
>>>>>>>
>>>>>>> + ti->addType( new StdTypeInfo<long>("long") );
>>>>>>>
>>>>>>> ti->addType( new BoolTypeInfo() );
>>>>>>> ti->addType( new TypeInfoName<void>("void"));
>>>>>> I think C++ maps long to int. So if you do this, it will just
>>>>>> replace/alias the int type.
>>>>> No, not necessarily. On my 64bit platform long is 8 bytes and int is
>>>>> 4. On 32bit they will probably be the same.
>>>> So, this seems to be a pandora box for (actual as well as later)
>>>> interoperability problems...
>>> It depends: sometimes you need the size of the integer to grow with
>>> your platforms native size, at others your application requires a
>>> fixed size.
>> For these cases, I would recommend using size_t, but that will be unsigned...
>>
>> Anyway, for literally adding long, the line you suggest will then be ok for
>> both 32/64bit (the aliasing will be done by RTT if necessary), but you'll also
>> have to define all the conversions from long to int to bool etc.
>>
>> Peter
> A solution could be to use types that explicitely give the corresponding bit size.
> Such as the Google coding style suggests:
>
> "Of the built-in C++ integer types, the only one used is int. If a program needs a variable of a different size, use a precise-width integer type from <stdint.h>, such as int16_t."
>
> from http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Integer_T...
>
> Charles.
This suggestion makes a lot of sense. Why not add uint8, int8, uint16, ..., int64?
S
adding 'long' as basic RTT type
2011/6/10 S Roderick <kiwi [dot] net [..] ...>
> On Jun 10, 2011, at 03:39 , Charles Lesire-Cabaniols wrote:
>
> On 10/06/2011 09:33, Peter Soetens wrote:
>
> On Friday 10 June 2011 09:07:17 Markus Klotzbuecher wrote:
>
> On Fri, Jun 10, 2011 at 09:02:44AM +0200, Herman Bruyninckx wrote:
>
> On Fri, 10 Jun 2011, Markus Klotzbuecher wrote:
>
> On Thu, Jun 09, 2011 at 03:25:37PM +0200, Peter Soetens wrote:
>
> On Thursday 09 June 2011 10:47:59 Markus Klotzbuecher wrote:
>
> Hi,
>
> Are there any objections against adding 'long' as standard RTT type?
>
> Markus
>
>
> From 81ceb191e43c1e5bc15b089edf53384b565cf08b Mon Sep 17 00:00:00
> 2001
>
> From: Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...> <markus [dot] klotzbuecher [..] ...>
> Date: Thu, 9 Jun 2011 10:47:18 +0200
> Subject: [PATCH] add long to rtt typekit
>
> ---
>
> rtt/typekit/RealTimeTypekitTypes.cpp | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/rtt/typekit/RealTimeTypekitTypes.cpp
> b/rtt/typekit/RealTimeTypekitTypes.cpp index 5730799..5091033 100644
> --- a/rtt/typekit/RealTimeTypekitTypes.cpp
> +++ b/rtt/typekit/RealTimeTypekitTypes.cpp
> @@ -67,6 +67,7 @@ namespace RTT
>
> ti->addType( new StdTypeInfo<double>("double") );
> ti->addType( new StdTypeInfo<float>("float") );
> ti->addType( new StdTypeInfo<char>("char") );
>
> + ti->addType( new StdTypeInfo<long>("long") );
>
> ti->addType( new BoolTypeInfo() );
> ti->addType( new TypeInfoName<void>("void"));
>
> I think C++ maps long to int. So if you do this, it will just
> replace/alias the int type.
>
> No, not necessarily. On my 64bit platform long is 8 bytes and int is
> 4. On 32bit they will probably be the same.
>
> So, this seems to be a pandora box for (actual as well as later)
> interoperability problems...
>
> It depends: sometimes you need the size of the integer to grow with
> your platforms native size, at others your application requires a
> fixed size.
>
> For these cases, I would recommend using size_t, but that will be unsigned...
>
> Anyway, for literally adding long, the line you suggest will then be ok for
> both 32/64bit (the aliasing will be done by RTT if necessary), but you'll also
> have to define all the conversions from long to int to bool etc.
>
> Peter
>
> A solution could be to use types that explicitely give the corresponding
> bit size.
> Such as the Google coding style suggests:
>
> "Of the built-in C++ integer types, the only one used is int. If a program
> needs a variable of a different size, use a precise-width integer type from
> <stdint.h>, such as int16_t."
>
> from
> http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Integer_T...
>
> Charles.
>
>
> This suggestion makes a lot of sense. Why not add uint8, int8, uint16, ...,
> int64?
>
this would be very nice to have. When working with drivers you often have
this need
> S
>
>
> --
> Orocos-Dev mailing list
> Orocos-Dev [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev
>
>
adding 'long' as basic RTT type
On Fri, Jun 10, 2011 at 12:46:28PM +0200, Willy Lambert wrote:
>
>
> 2011/6/10 S Roderick <kiwi [dot] net [..] ...>
>
> On Jun 10, 2011, at 03:39 , Charles Lesire-Cabaniols wrote:
>
>
> On 10/06/2011 09:33, Peter Soetens wrote:
>
> On Friday 10 June 2011 09:07:17 Markus Klotzbuecher wrote:
>
> On Fri, Jun 10, 2011 at 09:02:44AM +0200, Herman Bruyninckx wrote:
>
> On Fri, 10 Jun 2011, Markus Klotzbuecher wrote:
>
> On Thu, Jun 09, 2011 at 03:25:37PM +0200, Peter Soetens wrote:
>
> On Thursday 09 June 2011 10:47:59 Markus Klotzbuecher wrote:
>
> Hi,
>
> Are there any objections against adding 'long' as standard RTT type?
>
> Markus
>
>
> From 81ceb191e43c1e5bc15b089edf53384b565cf08b Mon Sep 17 00:00:00
> 2001
>
> From: Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
> Date: Thu, 9 Jun 2011 10:47:18 +0200
> Subject: [PATCH] add long to rtt typekit
>
> ---
>
> rtt/typekit/RealTimeTypekitTypes.cpp | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/rtt/typekit/RealTimeTypekitTypes.cpp
> b/rtt/typekit/RealTimeTypekitTypes.cpp index 5730799..5091033 100644
> --- a/rtt/typekit/RealTimeTypekitTypes.cpp
> +++ b/rtt/typekit/RealTimeTypekitTypes.cpp
> @@ -67,6 +67,7 @@ namespace RTT
>
> ti->addType( new StdTypeInfo<double>("double") );
> ti->addType( new StdTypeInfo<float>("float") );
> ti->addType( new StdTypeInfo<char>("char") );
>
> + ti->addType( new StdTypeInfo<long>("long") );
>
> ti->addType( new BoolTypeInfo() );
> ti->addType( new TypeInfoName<void>("void"));
>
> I think C++ maps long to int. So if you do this, it will just
> replace/alias the int type.
>
> No, not necessarily. On my 64bit platform long is 8 bytes and int is
> 4. On 32bit they will probably be the same.
>
> So, this seems to be a pandora box for (actual as well as later)
> interoperability problems...
>
> It depends: sometimes you need the size of the integer to grow with
> your platforms native size, at others your application requires a
> fixed size.
>
> For these cases, I would recommend using size_t, but that will be unsigned...
>
> Anyway, for literally adding long, the line you suggest will then be ok for
> both 32/64bit (the aliasing will be done by RTT if necessary), but you'll also
> have to define all the conversions from long to int to bool etc.
>
> Peter
>
> A solution could be to use types that explicitely give the
> corresponding bit size.
> Such as the Google coding style suggests:
>
> "Of the built-in C++ integer types, the only one used is int. If a
> program needs a variable of a different size, use a precise-width
> integer type from <stdint.h>, such as int16_t."
>
> from http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#
> Integer_Types
>
> Charles.
>
>
> This suggestion makes a lot of sense. Why not add uint8, int8, uint16, ...,
> int64?
>
>
> this would be very nice to have. When working with drivers you often have this
> need
+1
Markus
adding 'long' as basic RTT type
On 10/06/2011 12:53, Markus Klotzbuecher wrote:
> On Fri, Jun 10, 2011 at 12:46:28PM +0200, Willy Lambert wrote:
>>
>> 2011/6/10 S Roderick<kiwi [dot] net [..] ...>
>>
>> On Jun 10, 2011, at 03:39 , Charles Lesire-Cabaniols wrote:
>>
>>
>> On 10/06/2011 09:33, Peter Soetens wrote:
>>
>> On Friday 10 June 2011 09:07:17 Markus Klotzbuecher wrote:
>>
>> On Fri, Jun 10, 2011 at 09:02:44AM +0200, Herman Bruyninckx wrote:
>>
>> On Fri, 10 Jun 2011, Markus Klotzbuecher wrote:
>>
>> On Thu, Jun 09, 2011 at 03:25:37PM +0200, Peter Soetens wrote:
>>
>> On Thursday 09 June 2011 10:47:59 Markus Klotzbuecher wrote:
>>
>> Hi,
>>
>> Are there any objections against adding 'long' as standard RTT type?
>>
>> Markus
>>
>>
>> From 81ceb191e43c1e5bc15b089edf53384b565cf08b Mon Sep 17 00:00:00
>> 2001
>>
>> From: Markus Klotzbuecher<markus [dot] klotzbuecher [..] ...>
>> Date: Thu, 9 Jun 2011 10:47:18 +0200
>> Subject: [PATCH] add long to rtt typekit
>>
>> ---
>>
>> rtt/typekit/RealTimeTypekitTypes.cpp | 1 +
>> 1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> diff --git a/rtt/typekit/RealTimeTypekitTypes.cpp
>> b/rtt/typekit/RealTimeTypekitTypes.cpp index 5730799..5091033 100644
>> --- a/rtt/typekit/RealTimeTypekitTypes.cpp
>> +++ b/rtt/typekit/RealTimeTypekitTypes.cpp
>> @@ -67,6 +67,7 @@ namespace RTT
>>
>> ti->addType( new StdTypeInfo<double>("double") );
>> ti->addType( new StdTypeInfo<float>("float") );
>> ti->addType( new StdTypeInfo<char>("char") );
>>
>> + ti->addType( new StdTypeInfo<long>("long") );
>>
>> ti->addType( new BoolTypeInfo() );
>> ti->addType( new TypeInfoName<void>("void"));
>>
>> I think C++ maps long to int. So if you do this, it will just
>> replace/alias the int type.
>>
>> No, not necessarily. On my 64bit platform long is 8 bytes and int is
>> 4. On 32bit they will probably be the same.
>>
>> So, this seems to be a pandora box for (actual as well as later)
>> interoperability problems...
>>
>> It depends: sometimes you need the size of the integer to grow with
>> your platforms native size, at others your application requires a
>> fixed size.
>>
>> For these cases, I would recommend using size_t, but that will be unsigned...
>>
>> Anyway, for literally adding long, the line you suggest will then be ok for
>> both 32/64bit (the aliasing will be done by RTT if necessary), but you'll also
>> have to define all the conversions from long to int to bool etc.
>>
>> Peter
>>
>> A solution could be to use types that explicitely give the
>> corresponding bit size.
>> Such as the Google coding style suggests:
>>
>> "Of the built-in C++ integer types, the only one used is int. If a
>> program needs a variable of a different size, use a precise-width
>> integer type from<stdint.h>, such as int16_t."
>>
>> from http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#
>> Integer_Types
>>
>> Charles.
>>
>>
>> This suggestion makes a lot of sense. Why not add uint8, int8, uint16, ...,
>> int64?
>>
>>
>> this would be very nice to have. When working with drivers you often have this
>> need
> +1
> Markus
I am quite busy till tuesday, but if nobody is working on it, I can
propose a patch for these types (and the corresponding casts) during
next week.
Charles.
adding 'long' as basic RTT type
On Friday 10 June 2011 13:05:33 Charles Lesire-Cabaniols wrote:
> On 10/06/2011 12:53, Markus Klotzbuecher wrote:
> > On Fri, Jun 10, 2011 at 12:46:28PM +0200, Willy Lambert wrote:
> >> 2011/6/10 S Roderick<kiwi [dot] net [..] ...>
> >>
> >> On Jun 10, 2011, at 03:39 , Charles Lesire-Cabaniols wrote:
> >> On 10/06/2011 09:33, Peter Soetens wrote:
> >> On Friday 10 June 2011 09:07:17 Markus Klotzbuecher wrote:
...
> >>
> >> This suggestion makes a lot of sense. Why not add uint8, int8,
> >> uint16, ..., int64?
> >>
> >> this would be very nice to have. When working with drivers you often
> >> have this need
> >
> > +1
> > Markus
>
> I am quite busy till tuesday, but if nobody is working on it, I can
> propose a patch for these types (and the corresponding casts) during
> next week.
Keep in mind that
1. ros adds these too/already, so please keep the names equal
2. It might be better to put this in a separate package, which we can add to
the orocos-toolchain
3. If you want to support these data types on data ports or not. I'm working
on a patch that distinguishes primitive types from 'flow port' types. since
typekits containing flow port types take ages to compile and are pretty big.
I would vote for not allowing them on ports (properties, operation parameters
etc are all fine). There's currently (2.4) no way to express this, but we
should consider where we want to take this.
4. You'll need to provide corba transports too.
5. You'll need to provide a Types.hpp header which contains the extern
template declarations.
Peter
adding 'long' as basic RTT type
On 10/06/2011 14:34, Peter Soetens wrote:
>
> Keep in mind that
>
> 1. ros adds these too/already, so please keep the names equal
> 2. It might be better to put this in a separate package, which we can add to
> the orocos-toolchain
I have created a stdint-typekit repository on Orocos Toolchain.
I have not pushed the typekit yet; all is on my own git repo.
I have defined types int16, int32, int64 and uint16, uint32, uint64.
I have aliased the int (and uint) types when possible, although I don't
know whether the alias concept is fixed or not (but I hope it will be at
the moment I will release the stdint-typekit !)
For int8/uint8, it is a bit more complicated, as they are generally
mapped to 'char', which is already defined on the RTT types, but not
dealt with as integers... these types are then not added by default (I
have #ifdef their instructions).
> 3. If you want to support these data types on data ports or not. I'm working
> on a patch that distinguishes primitive types from 'flow port' types. since
> typekits containing flow port types take ages to compile and are pretty big.
> I would vote for not allowing them on ports (properties, operation parameters
> etc are all fine). There's currently (2.4) no way to express this, but we
> should consider where we want to take this.
> 4. You'll need to provide corba transports too.
> 5. You'll need to provide a Types.hpp header which contains the extern
> template declarations.
The last thing to do for the typekit itself, is to define and install
this Types.hpp header.
I thought I could inspire from the Types.hpp of the RTT typekit, but it
contains lot of #ifdef guards, and I have no access to the corresponding
variables unless I am on the 'rtt' install process.
Could I have some tips here?
The very last things to do will be to declare the package on the
toolchain package_set, and test the creation of a component using these
types as ports/properties.
Charles.
adding 'long' as basic RTT type
Hi devs,
Following our discussion on the 'stdint' typekit, I propose a
pre-release today.
I have only tested the installation on my 'autoproj' tree. The
'stdint-typekit' package is known by autoproj if you are on the master
branch. To get it, you just have to add a line '- stdint-typekit' on the
layout section of your autoproj/manifest file.
You can also try it if you are not on the master branch: just add
'cmake_package "stdint-typekit"' to the
autoproj/remotes/orocos.toolchain/orocos.autobuilt file.
For others, get the sources from
gitorious.org:orocos-toolchain/stdint-typekit.git; compilation uses the
Orocos CMake macro 'orocos_plugin', so I hope all will work correctly.
The typekit files are installed in the 'orocos/stdint' subdir of the
install tree, so that they are not imported by default. To use it from
the deployer, just type
'import("stdint")', and you should see the stdint types in '.types'.
The provided types are [u]int{16,32,64}. They correspond to the
?int_leastX_t type defined in stdint.h.
I have chosen to map to this '?int_leastX_t' types because:
- they are mandatory on the stdint.h file (while ?intX_t are not);
- on most system they correspond to commonly used ?intX_t;
- they make the typekit usable on exotic platforms.
int8 and uint8 are not provided, as they are generally mapped to
'[u]char', and I have some conflict with the standard 'char' type of the
RTT typekit.
However, you can force the typekit to provide them by adding a
-DADD_INT8_TYPE to your compilation command.
I have aliased already registered types (such as int and uint) when
possible ; constructors/casters and basic operations are there.
All casts are possible, even if you try to fill a variable whose type
is 'smaller' than the source one.
Regarding using these types in components, I have just tested with two
components exchanging stdint types through their ports. I have not
tested properties and operations.
Enjoy ;)
Charles.
adding 'long' as basic RTT type
Hi Charles,
On Wed, Jun 29, 2011 at 07:10:15PM +0200, Charles Lesire-Cabaniols wrote:
> Hi devs,
>
> Following our discussion on the 'stdint' typekit, I propose a
> pre-release today.
Thanks a lot for the effort!
I think this will be very useful.
Markus
adding 'long' as basic RTT type
On 10/06/2011 14:34, Peter Soetens wrote:
> On Friday 10 June 2011 13:05:33 Charles Lesire-Cabaniols wrote:
>> On 10/06/2011 12:53, Markus Klotzbuecher wrote:
>>> On Fri, Jun 10, 2011 at 12:46:28PM +0200, Willy Lambert wrote:
>>>> 2011/6/10 S Roderick<kiwi [dot] net [..] ...>
>>>>
>>>> On Jun 10, 2011, at 03:39 , Charles Lesire-Cabaniols wrote:
>>>> On 10/06/2011 09:33, Peter Soetens wrote:
>>>> On Friday 10 June 2011 09:07:17 Markus Klotzbuecher wrote:
> ...
>>>>
>>>> This suggestion makes a lot of sense. Why not add uint8, int8,
>>>> uint16, ..., int64?
>>>>
>>>> this would be very nice to have. When working with drivers you often
>>>> have this need
>>> +1
>>> Markus
>> I am quite busy till tuesday, but if nobody is working on it, I can
>> propose a patch for these types (and the corresponding casts) during
>> next week.
> Keep in mind that
>
> 1. ros adds these too/already, so please keep the names equal
Sure. ROS types are stdint types anyway ([u]int{8,16,32,64}).
> 2. It might be better to put this in a separate package, which we can add to
> the orocos-toolchain
Ok, good idea. Any proposition on the package name? stdint-typekit ?
> 3. If you want to support these data types on data ports or not. I'm working
> on a patch that distinguishes primitive types from 'flow port' types. since
> typekits containing flow port types take ages to compile and are pretty big.
> I would vote for not allowing them on ports (properties, operation parameters
> etc are all fine). There's currently (2.4) no way to express this, but we
> should consider where we want to take this.
How could I distinguish the two kinds of type for the moment?
Moreover, IMO, types provided by the toolchain should be both, as we
cannot only provide primitive types and let users redefine a typekit to
adding 'long' as basic RTT type
On Fri, 10 Jun 2011, Peter Soetens wrote:
> On Friday 10 June 2011 13:05:33 Charles Lesire-Cabaniols wrote:
>> On 10/06/2011 12:53, Markus Klotzbuecher wrote:
>>> On Fri, Jun 10, 2011 at 12:46:28PM +0200, Willy Lambert wrote:
>>>> 2011/6/10 S Roderick<kiwi [dot] net [..] ...>
>>>>
>>>> On Jun 10, 2011, at 03:39 , Charles Lesire-Cabaniols wrote:
>>>> On 10/06/2011 09:33, Peter Soetens wrote:
>>>> On Friday 10 June 2011 09:07:17 Markus Klotzbuecher wrote:
> ...
>>>>
>>>> This suggestion makes a lot of sense. Why not add uint8, int8,
>>>> uint16, ..., int64?
>>>>
>>>> this would be very nice to have. When working with drivers you often
>>>> have this need
>>>
>>> +1
>>> Markus
>>
>> I am quite busy till tuesday, but if nobody is working on it, I can
>> propose a patch for these types (and the corresponding casts) during
>> next week.
>
> Keep in mind that
>
> 1. ros adds these too/already, so please keep the names equal
> 2. It might be better to put this in a separate package, which we can add to
> the orocos-toolchain
> 3. If you want to support these data types on data ports or not. I'm working
> on a patch that distinguishes primitive types from 'flow port' types. since
> typekits containing flow port types take ages to compile and are pretty big.
> I would vote for not allowing them on ports
+1! This is one of the _major_ distinctions between a Port and a
Connection/Service :-)
> (properties, operation parameters
> etc are all fine). There's currently (2.4) no way to express this, but we
> should consider where we want to take this.
> 4. You'll need to provide corba transports too.
In my opinion, this is the responsibility of the CORBA transport
maintainer. Imposing CORBA in this way on the RTT community is not wise.
> 5. You'll need to provide a Types.hpp header which contains the extern
> template declarations.
>
> Peter
Herman