Sunday, June 16, 2013

FeedaMail: Comments for Sutter’s Mill

feedamail.com Comments for Sutter's Mill

Comment on GotW #94 Special Edition: AAA Style (Almost Always Auto) by mttpd

@Herb: Oh, since you mention rise4fun, I have a related question real quick /* if you’re not the right guy to ask, apologies in advance; perhaps you could pass it on? :-) */.

Is there any chance to extend it to work like the other online compilers linked to from http://isocpp.org/get-started — in particular Stacked-Crooked or ideone.com — i.e., to run the program and show the output?

What’s really nice about Stacked-Crooked in particular is that it also supports Boost, which allows to quickly test (and share) code snippets such as this:
http://coliru.stacked-crooked.com/view?id=4af2bf3c771a9413c642dd8e26007df8-3725be9f9ce62f113fc473b4ae69c419

Regardless, another issue is the following:
“testvc.cpp(1) : info : Ignoring directive ‘#include’, which cannot be used in this online version of the Visual C++ compiler”

This is a problem for verifying the correctness of the code at hand — for instance, std::size_t ordinarily requires an inclusion of a header like cstddef (there are others), and rise4fun automatically including all the standard headers (which seems to be implied by the support for library constructs such as std::vector) currently leaves simple mistakes like this undiagnosed (I’d also imagine this leads to a heavier strain on the servers supporting rise4fun, so if anything, fixing this should be a win-win).

Pretty please? :-)

Read More »

Comment on GotW #94 Special Edition: AAA Style (Almost Always Auto) by Lev

1. What’s the point of using emplace_back() if v is not an rvalue reference?

Read More »

Comment on GotW #94 Special Edition: AAA Style (Almost Always Auto) by Sil

Herb,
Thanks for answering quickly.

Looking forward to watching your talk at build!

Read More »

Comment on GotW #94 Special Edition: AAA Style (Almost Always Auto) by John

This isn’t compiling for me:

  auto buffer = char[10]{};  

If it could compile, I think buffer would be a char*, not char[10].
Right?

Read More »

Comment on GotW #94 Special Edition: AAA Style (Almost Always Auto) by Bret Kuhns

@Jeff Harris, you first show

auto w = getWidget();

Then note that it is different than

const Widget& w = getWidget();

Notice the asymmetry in these examples? Now how do we use `auto` to match the second line?

const auto& w = getWidget();

Pretty symmetric. We control when we get a copy, or when we get a reference to const, and it’s all documented at the declaration site.

Read More »

Comment on GotW #94 Special Edition: AAA Style (Almost Always Auto) by litb1

@John That is right. It was subject of a recent SO discussion. The solution/workaround for the case where the wished type is an array is to use a reference, which prevents automatic decay

 auto &&x = identity <int []>{a, b, c}; 

But honestly, I am going to continue writing “type var{init}”.

Read More »

Comment on GotW #93 Solution: Auto Variables, Part 2 by khurshid

auto x = widget{}; // doesn’t compiled with non-copyable classes.

example:
struct widget{
widget( const widget& ) = delete;
widget& operator = (const widget& ) = delete;
widget() = default;
~widget() = default;
};

widget w; // compiled OK;
auto w = widget{}; // compile ERROR!

Read More »
 
Delievered to you by Feedamail.
Unsubscribe

No comments:

Post a Comment