[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [4diac-dev] 回复: CSinglyLinkedList improvements
|
On Fri, 2022-04-29 at 10:32 +0200, Davor Cihlar wrote:
> So there are no more platforms that doesn't support STL?
AFAIK no. But up to now I'm personally considering STL mostly for new code. Haven't yet found time and need to rework the existing code.
> In that case I would also consider std::list as a direct replacement. Unlike std::vector it has constant insertion/removal time, and I expect it to minimize
> memory fragmentation on embedded devices. Of course, if random access is required then std::vector is preferred.
This strongly depends on the use case. std::list is good when you insert and remove often. We mostly don't have that. Also we often store pointers. In that case
std::list has 200% overhead. Also std:vector has a nice feature that you can sort it and find things faster. Therefore many people recommend std:vector over
std::lists. I think we can get some memory and speed enhancemetns with std::vector.
> Has anyone considered boost? I know it's often times avoided, but it has some more embedded friendly implementations. I.e. lists with static allocation. But I
> never had an opportunity to work with it so I don't have any experience with it.
we use boost for the test framework. But never looked beyond that.
> I also have some other suggestions:
> * use std::thread and synchronization mechanisms from STL, that can be ported to embedded devices with not too much effort
Here I'm not sure. It definitly is worth a look. But I have no experience about it.
> * use std::chrono - in the current implementation I never know what time unit to expect. And I know I'm not the only one because of a bug in OPC UA I found
> some time ago.
For me the same as for std::thread
>
> On 4/29/22 10:08, Martin Melik-Merkumians wrote:
>
> > Hi,
> >
> > it should be rather straight forward, as I tried to mimic the std containers back then when I implemented the CSinglyLinkedList.
> >
> > Best regards,
> > Martin
> >
> > --------------------------------------------------
> > Dipl.-Ing. Martin Melik-Merkumians
> > Advanced Mechatronic Systems
> > Automation and Control Institute (ACIN)
> > TU Wien
> > DVR-Number: 0005886
> >
> > Gusshausstr. 27-29, room CD-04-24
> > 1040 Vienna, Austria
> > Phone: +43 (0)1 588 01 37688
> > Fax: +43 (0)1 588 01 937688
> > Email: melik-merkumians@xxxxxxxxxxxxxxxxx
> > http://www.acin.tuwien.ac.at/
> > --------------------------------------------------
> >
> > -----Ursprüngliche Nachricht-----
> > Von: 4diac-dev <4diac-dev-bounces@xxxxxxxxxxx> Im Auftrag von zhaoxin@xxxxxxxxxxxxxxxxx
> > Gesendet: Freitag, 29. April 2022 10:06
> > An: alois.zoitl@xxxxxx; '4diac developer discussions' <4diac-dev@xxxxxxxxxxx>
> > Betreff: [4diac-dev] 回复: CSinglyLinkedList improvements
> >
> > Hi,
> >
> > I guess we'd better move to std::vector instead of update CSinglyLinkedList.
> >
> > I have done that for OPC DA module. It seems doable.
> >
> > Regards
> > Tibalt
> >
> > -----邮件原件-----
> > 发件人: 4diac-dev-bounces@xxxxxxxxxxx <4diac-dev-bounces@xxxxxxxxxxx> 代表 Alois Zoitl
> > 发送时间: 2022年4月29日 3:37
> > 收件人: 4diac developer discussions <4diac-dev@xxxxxxxxxxx>
> > 主题: Re: [4diac-dev] CSinglyLinkedList improvements
> >
> > Hi Davor,
> >
> > thanks for looking on our code and trying to improve it. We have this single list implementation because when we started 4diac FORTE we had platforms that
> > had no STL available. Now this is obsolete and my personal goal is to get rid of it step by step.
> >
> > Therefore my suggestion is no new code should use CSinglyLinkedList anymore. Better use std:vector.
> >
> > Therefore I'm also not sure if it makes sense to spend time on improving it. What are you or others thinking.
> >
> > Cheers,
> > Alois
> >
> > On Thu, 2022-04-28 at 21:30 +0200, Davor Cihlar wrote:
> >
> > > Hi again!
> > > Since Forte moved to c++11 I'm using the new features in my PostgreSQL implementation. To be able to use std::move properly I've upgraded
> > > CSinglyLinkedList.
> > > I would like to contribute those changes, but first I think it would make sense to know nobody else is working on this?
> > >
> > > While I was at it, I also noticed some irregularities in the
> > > implementation. In a few places const is not used properly. I.e.
> > > CSinglyLinkedList::begin()const is returning a const Iterator - an Iterator that can only stay in one place! Instead of returning a non-const Iterator
> > > that handles const data. At some point I actually had a problem with that.
> > > It appears that this doesn't matter for the whole Forte code, but it still should probably be fixed. On the other hand this may be a bit more work.
> > >
> > > Now, before making any contributions, I also need to figure out first how unit testing is set up on this project.
> > > _______________________________________________
> > > 4diac-dev mailing list
> > > 4diac-dev@xxxxxxxxxxx
> > > To unsubscribe from this list, visit
> > > https://www.eclipse.org/mailman/listinfo/4diac-dev
> > _______________________________________________
> > 4diac-dev mailing list
> > 4diac-dev@xxxxxxxxxxx
> > To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/4diac-dev
> >
> > _______________________________________________
> > 4diac-dev mailing list
> > 4diac-dev@xxxxxxxxxxx
> > To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/4diac-dev
> > _______________________________________________
> > 4diac-dev mailing list
> > 4diac-dev@xxxxxxxxxxx
> > To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/4diac-dev
> _______________________________________________
> 4diac-dev mailing list
> 4diac-dev@xxxxxxxxxxx
> To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/4diac-dev