On Wed, Sep 17, 2014 at 09:40:44PM +0200, q...@c9x.me wrote: > On Wed, Sep 17, 2014 at 07:42:47PM +0100, Maxime Coste wrote: > > > That doesn???t happen that often to justify overloading. Hint: Avoided > > > complexity in the system *beforehand*. > > > > That goes back to the linked list/array thing, you dont have generics, so > > you use the > > easy thing without generics: linked lists, which are almost always a poor > > choice. > > I don't think that is true, static arrays do the job way more often than > people want > to admit, and they are very well supported by C. Also, performance is > critical in > less cases than people like Bjarne Stroustrup want to admit, when it's > critical you > probably don't even want to rely on STL since it is not finely tuned (as > Facebook's > home brewed library shows, for instance).
Yep, static arrays do the trick in many cases, and the STL is not always the best choice. What I say is that when you need a list that can handle an arbitrary number of elements, dynamic arrays are the best bet, and you can write a generic one and reuse it in C++, but to have one in C gets rapidly ugly and people end up prefering a quick and dirty linked list. In the end, its just an example to show that the lack of abstraction mechanism of C can have bad influence on performances, because C programmers like all other do like convenience. Cheers, Maxime Coste.