tag:blogger.com,1999:blog-6714530.post330226747817289264..comments2023-12-20T14:46:32.704+00:00Comments on less code, more software: Larry and Jen do Roman Numerals in C++Jon Jaggerhttp://www.blogger.com/profile/11560463167349216675noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-6714530.post-13840414887180318312014-02-22T17:33:53.325+00:002014-02-22T17:33:53.325+00:00Hi Jon,
Your slides are perfect as they are! They...Hi Jon,<br /><br />Your slides are perfect as they are! They show in an entertaining way, how good co-working can improve the result of our work (what is not only true for programming).<br /><br />I was just triggered by Scott Meyers comment and my proposal was rather an reply to him, than a comment about Your slides. Surely this is not the right place for code style discussion. I am sorry about that.<br /><br />Cheers,<br /><br />Kai<br /><br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6714530.post-56228102744660665262014-02-21T16:43:38.203+00:002014-02-21T16:43:38.203+00:00Hi Kai,
thank you for your kind comment.
I'm n...Hi Kai,<br />thank you for your kind comment.<br />I'm not going to add your suggestion to the slide-deck for three reasons<br />1) it's a lot of work writing even a few build-by-build slides in a deck like this!<br />2) I don't think it fits with the story. The level of C++ in the story is deliberately quite simple. The deck is not about me making the best possible C++ code I can write... it's about trying to help the reader (who I have targetted at a certain level) as much as possible.<br />3) I don't want the final code to be "perfect" - in the story they deliberately leave some suggestions hanging (eg the linkage if I recall). It's not about the code; it's about their learning which carries on after the deck ends!<br />Cheers<br />Jon<br />Jon Jaggerhttps://www.blogger.com/profile/11560463167349216675noreply@blogger.comtag:blogger.com,1999:blog-6714530.post-4231664224079737912014-02-21T12:36:32.451+00:002014-02-21T12:36:32.451+00:00These are really great slides!
I have an additiona...These are really great slides!<br />I have an additional remark to Scott Meyers comments. I don't like the C stuff as well. What do You think about<br />something like this:<br /><br />template <br />inline constexpr size_t size(const T (&)[N]) { return N; }<br /><br />It is safe and can also be resolved at compile time like the C variant. In addition there could be a version for containers.<br />The we would have a unified non-member version of size() similar to std::begin() and std::end().<br />So probably it's worth adding it into a future standard!?<br /><br /><br />Cheers,<br /><br />Kai<br /><br /><br /><br /><br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6714530.post-42625255093237823382013-08-19T22:17:49.810+00:002013-08-19T22:17:49.810+00:00Hi Jon. You're right, std::array won't ded...Hi Jon. You're right, std::array won't deduce its size from its initializer. I overlooked that. std::vector would, however, though that would require the use of heap memory, which some would find disturbing. I personally view the C mechanism for determining the number of elements in an array rather hackish, and the C++ template approach (using a template to calculate the size by binding the array to a reference) isn't any better, IMO. I think that if you need to know the number of elements in a container, your first choice should be a container that can provide that information.Scott Meyershttps://www.blogger.com/profile/05280964633768289328noreply@blogger.comtag:blogger.com,1999:blog-6714530.post-89787925308276725562013-08-19T18:06:28.228+00:002013-08-19T18:06:28.228+00:00Hi Scott,
I must be missing something... Wouldn&#...Hi Scott, <br />I must be missing something... Wouldn't the declaration of the std::array object require the size? Could you provide an example?<br />Thanks<br />Jon Jaggerhttps://www.blogger.com/profile/11560463167349216675noreply@blogger.comtag:blogger.com,1999:blog-6714530.post-90112817913596410542013-08-19T16:41:28.706+00:002013-08-19T16:41:28.706+00:00Given that this is a C++ solution, I suggest you r...Given that this is a C++ solution, I suggest you replace the use of arrays with std::array objects. To get the number of elements in the std::array, you can just call the size member function. This will eliminate the need to use the C idiom for calculating the number of elements in an array.Scott Meyershttps://www.blogger.com/profile/05280964633768289328noreply@blogger.comtag:blogger.com,1999:blog-6714530.post-41013692037445263362013-08-16T10:21:14.315+00:002013-08-16T10:21:14.315+00:00Fantastic!Fantastic!Rafaelahttp://besttreadmillforhomes.us/2013/08/08/choosing-the-right-treadmill-advice/noreply@blogger.com