Re: [Widelands-public] My first post, my first patch
Status: Beta
Brought to you by:
sirver
From: Holger R. <Si...@gm...> - 2012-05-06 16:35:43
|
Hello Aelia and welcome to the list! >The first this I disliked are the Warnings the compiler sends when >compiling with -Wall -Wextra so I send this (simple) patch to correct >things. Thanks! such patches are always appreciated. I committed it in r6381. Could you tell me what name should appear in txt/developers for you? >My intention is sending patches not bazar pull requests (I dislike >bazar -- and as you can see I use git). If it is a problem for you just >tell me. We are not very picky how patches are submitted and for small things we do not insist on bzr branches. However, patches are better uploaded into the bug tracker - we live there now as mailinglists are going out of style. >The next thing I think I will touch is the MD5CheckSum template... in >fact I nearly choked to death when I saw how it is used (particularly >the ::Data() method jungle with StreamRead and StreamWrite). I don't >even understand why it is a template... a plain class would work just >as fine (from what I see -- correct me if I am wrong). Well, 'didn't understand' then maybe you should be a little more careful with your wording. What you see is a well known C++ pattern known as Curiously recurring template[1]. It is used (in this case) to to allow for polymorphism without runtime cost. The Checksum class is used very, very often in widelands, so I guess this was an optimization decision back then - I doubt though that it was really benchmarked out and I even doubt that this pattern buys much cycles here. Nevertheless, it is a nice trick up the programmers sleeve. [1] http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern Cheers, Holger |