Prev: Lifetime of a temporary bound to a reference
Next: When I convert "0.0003" and "3.e-4" in VC++ they are the same
From: Olve Maudal on 28 Jun 2010 05:51 At the NDC2010 conference, I gave a presentation where I demonstrated Solid C++ code by example: http://www.slideshare.net/olvemaudal/solid-c-by-example It would be great to have your opinion about the examples I present. Is this solid code, or can it be improved even further? Thanks, - olve -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: Johannes Schaub (litb) on 28 Jun 2010 10:32 Olve Maudal wrote: > At the NDC2010 conference, I gave a presentation where I demonstrated > Solid C++ code by example: > > http://www.slideshare.net/olvemaudal/solid-c-by-example > > It would be great to have your opinion about the examples I present. > Is this solid code, or can it be improved even further? > One thing i really don't agree with is depending on things included by other 3rd party headers. I would also not recommend using a "size_t" to store an offset containing "12" - i think it's bad to use "unsigned" just to signify a quantity is unsigned. I personally like the other stuff in it :) -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: Edward Diener on 29 Jun 2010 05:25 On 6/28/2010 9:32 PM, Johannes Schaub (litb) wrote: > Olve Maudal wrote: > >> At the NDC2010 conference, I gave a presentation where I demonstrated >> Solid C++ code by example: >> >> http://www.slideshare.net/olvemaudal/solid-c-by-example >> >> It would be great to have your opinion about the examples I present. >> Is this solid code, or can it be improved even further? >> > > One thing i really don't agree with is depending on things included by other > 3rd party headers. > > I would also not recommend using a "size_t" to store an offset containing > "12" - i think it's bad to use "unsigned" just to signify a quantity is > unsigned. I have never understood such reasoning. If I have an integer value which I know must be unsigned, why would I not use an unsigned integer rather than a signed integer ? -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: eca on 29 Jun 2010 05:34 On Jun 28, 10:51 pm, Olve Maudal <olve.mau...(a)gmail.com> wrote: > It would be great to have your opinion about the examples I present. > Is this solid code, or can it be improved even further? In type1_message.hpp, including <vector> is considered superfluous, because already included in ntlm_message.hpp, which is true of course. However, I cannot say to what extent should we consider bad practice including headers that other ".h" already include, or whether should we prefer to achive a totally self-contained and autonomous header. Despite of many attempts of finding the Holy Grail of Include Practice, still I don't have a definitive opinion on the subject. Thanks in advance for your opinions, eca -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: Mathias Gaunard on 29 Jun 2010 05:35
On Jun 28, 9:51 pm, Olve Maudal <olve.mau...(a)gmail.com> wrote: > At the NDC2010 conference, I gave a presentation where I demonstrated > Solid C++ code by example: > > http://www.slideshare.net/olvemaudal/solid-c-by-example > > It would be great to have your opinion about the examples I present. > Is this solid code, or can it be improved even further? There is no stdint.h in standard C++, it's only in C99. There is cstdint in C++0x, and Boost provides a boost/cstdint.hpp file as well. Otherwise it seems ok. I think you should make a distinction between hard rules (things that should *always* or *never* be done), recommended rules, and things that are really just cosmetic standards that are good to follow (like putting public members before private ones). The set of rules is fairly small and is not enough to guarantee decent code in my opinion, but they are indeed good basic rules. A bit unrelated to coding standards, the implementation of pal::type1_message::as_bytes() seems somewhat suboptimal. -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] |