Tuesday, December 31, 2013

FeedaMail: Comments for Sutter’s Mill

feedamail.com Comments for Sutter's Mill

Comment on GotW #94 Solution: AAA Style (Almost Always Auto) by Declaration and initialization with auto | Feheren Fekete

[…] http://herbsutter.com/2013/08/12/gotw-94-solution-aaa-style-almost-always-auto/ […]

Read More »

Comment on GotW #93 Solution: Auto Variables, Part 2 by Declaration and initialization with auto | Feheren Fekete

[…] http://herbsutter.com/2013/06/13/gotw-93-solution-auto-variables-part-2/ […]

Read More »

Comment on GotW #92 Solution: Auto Variables, Part 1 by Declaration and initialization with auto | Feheren Fekete

[…] http://herbsutter.com/2013/06/07/gotw-92-solution-auto-variables-part-1/ […]

Read More »
 
Delievered to you by Feedamail.
Unsubscribe

Sunday, December 29, 2013

FeedaMail: Comments for Sutter’s Mill

feedamail.com Comments for Sutter's Mill

Comment on Recommended reading: Why mobile web apps are slow (Drew Crawford) by Recommended reading: Why mobile web apps are slow (Drew Crawford) by Herb Sutter | MolePlex

[…] Recommended reading: Why mobile web apps are slow (Drew Crawford) by Herb Sutter […]

Read More »
 
Delievered to you by Feedamail.
Unsubscribe

Monday, December 23, 2013

FeedaMail: Comments for Sutter’s Mill

feedamail.com Comments for Sutter's Mill

Comment on Perspective: "Why C++ Is Not 'Back'" by gast128

I have a love-hate relationship with c++. I like the plain abstraction, its syntax and its value semantics. On the other hand I cannot appreciate the following things:
- compilation speed. In my work we have a 100 project solution, which takes 1 hour to build. We already use pch and all the compilation tricks. Other people here use c# and that compiles in minutes. Is it related to all the Boost template stuff, or is MS deliberately holding back c++ compilation?
- templates. They are very handy but there are many dark corners. When we upgraded to vstudio 2008 we encountered a problem which took us days. It turned out to be a non obvious issue which was correctly rejected.
- c++ tendency to allow redefinition of variables in various scopes. Also with overloads there are many pitfalls.
- universal references. I am not sure who voted the current syntax in. The rules of turning a rvalue into a lvalue are not obvious.
- backward compatibility is good for the short term (everything stays compilable) but blocks long term evolution. I wouldn’t mind if a proposal break old code if that would improve build speeds (e.g. in the template syntax). Ofc there is many c++ code written, but can’t this be solved by compiler flags? K&R C has also died.

Read More »
 
Delievered to you by Feedamail.
Unsubscribe

Sunday, December 22, 2013

FeedaMail: Comments for Sutter’s Mill

feedamail.com Comments for Sutter's Mill

Comment on Perspective: "Why C++ Is Not 'Back'" by credit repair

You could repair your credit score on your own and that there’s nothing each credit repair team can do for you that, given practice and inquiry, you couldn't do for yourself. Indeed, the same could be reflected to many of the services people already purchase for on a daily basis. If you’re glancing for a credit repair company research the highly fair credit repair companies on our homepage.

Read More »

Comment on Visual C++ Compiler November 2013 CTP by Petter

The generic lambdas are great! They allow really cool interfaces to optimizers. For example:

  auto lambda =  	[](auto x)  	{  		auto d0 =  x[1] - x[0]*x[0];  		auto d1 =  1 - x[0];  		return 100 * d0*d0 + d1*d1;  	};    auto differentiable = make_differentiable<2>(lambda);  

This was not possible before,because the automatic differentiation must be able to pass different types into the lambda. This works very well.

Read More »
 
Delievered to you by Feedamail.
Unsubscribe

Friday, December 20, 2013

FeedaMail: Comments for Sutter’s Mill

feedamail.com Comments for Sutter's Mill

Comment on GotW #91 Solution: Smart Pointer Parameters by Bret Kuhns

@CS There was a proposal for this for C++1y, but didn’t make it into the draft. I believe the reasoning was that in the presence of `std::shared_ptr` and `std::unique_ptr`, raw points should always be expressed as observing. Unfortunately, your example of legacy code is exactly the reason why this was a bad decision. I would love to see the “worlds dumbest smart pointer” get revisited in the general library TS coming after C++14…

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3514.pdf

Read More »

Comment on GotW #94 Solution: AAA Style (Almost Always Auto) by void*

We have been trying to define a good strategy for the use of auto for a customer’s C++11 guidelines. Researching we found these nice three GotWs about auto. :) Thanks for those!

Trying to consequently use auto for local variables we ran into three situations where it does not work nicely:

  #include <vector>      class foo_t  {  public:     foo_t() {}       foo_t( const foo_t& ) = delete;       void bar() const {}  };      int main()  {     // example 1: doesn't work for pointer types     // auto i_ptr = int*{};       // like this it's fine     typedef int* int_ptr_t;     auto i_ptr_2 = int_ptr_t{};         // example 2: doesn't work for non-copyable classes     // compiles with VS2013, but I think it shouldn't (g++ doesn't like it)     //auto foo = foo_t{};         // example 3: auto does worse than manually written code can     std::vector< foo_t* > foo_ptrs;       // foo is not as const as it could be (only foo_t* const, could be const foo_t* const)     for( const auto foo : foo_ptrs )     {        foo->bar();     }       // better because it's "more" const     for( const foo_t* const foo: foo_ptrs )     {        foo->bar();     }  }  

- The pointer example is an edge case. Probably don’t need this very much in C++-code (and there’s a work around).
- Having non-copyable objects is more relevant though. I regularly see that…probably thanks to Scott Meyers (Effective C++, Item 6: Explicitly disallow the use of compiler-generated functions you do not want).
- The third situations occurs quite often in legacy code and it just runs against Effective C++, Item 3: Use const whenever possible

Any thoughts/comments about these three cases?

Best regards
Wolfgang Petroschka

Read More »
 
Delievered to you by Feedamail.
Unsubscribe

Thursday, December 19, 2013

FeedaMail: Comments for Sutter’s Mill

feedamail.com Comments for Sutter's Mill

Comment on GotW #90 Solution: Factories by Fahiem Bacchus

self documentation vs auto.
In example 2.

  unique_ptr<widget> load_widget( widget::id desired );  

You get self documentation—you can see in the code that you get control over widget.

Once you use auto

  // Accept as a unique_ptr (by default)  auto up = load_widget(1);  

we have to look up the signature of load_widget…it is no longer documented in the call.

This seems to be a subtle trade off here. Any thoughts?

Read More »
 
Delievered to you by Feedamail.
Unsubscribe

Wednesday, December 18, 2013

FeedaMail: Comments for Sutter’s Mill

feedamail.com Comments for Sutter's Mill

Comment on Reader Q&A: "Will C++ remain indispensable…?" by Patrick Fromberg

@Tim

Good languages need good forums. One big unnoticed achievement of C++11 has been improving the quality of the online discussions. The recent C++11 conference and video tsunami may have also contributed.

You say Garbage collection can be disabled in D. I have read this often but no clue what it means. I can write my own standard D library that does not use GC? Great! So I stopped reading D language forums. I will check in a year or so again to see if quality improved. After all, Alexandrescu is amazing (hopefully Herb will not read this)!

But even Alexandrescu is talking more C then D lately.

Read More »
 
Delievered to you by Feedamail.
Unsubscribe

Tuesday, December 17, 2013

FeedaMail: Comments for Sutter’s Mill

feedamail.com Comments for Sutter's Mill

Comment on GotW #94 Solution: AAA Style (Almost Always Auto) by White Wolf

Does “AAA” come with a 12 step program? I guess using ‘auto’ is already means trusting a higher power… ;)

Read More »

Comment on Reader Q&A: Book recommendations by Bikineev

Hello, Herb. Thank you for recommendations. Could you tell please, is there a good book/articles which explain compile-time patterns? (Not regarding Alexandrescu’s “Modern C++”)

Read More »

Comment on Visual C++ Compiler November 2013 CTP by Raman Sharma (@rasharm_)

Here is an example of using resumable/await in a C++ Windows Store app while using SQLite:

http://stackoverflow.com/questions/19309508/using-sqlite-winrt-from-a-c-windows-store-app

Read More »
 
Delievered to you by Feedamail.
Unsubscribe