-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dev-ooi: AdsClient.h does not compile with Visual Studio 2015 #38
Comments
I will take a look on this one later. Maybe VC++ is missing some c++11 feature or my knowledge is smaller than you think and gcc is just doing magic with my code ;-). Regards, |
The ironic thing is that what prevents me from using the STL in my daily work is the limited subset of the STL that is supported by TwinCAT 3.1 C++ modules :-) That rule of zero thing is a really clever idea. I already admired that solution in your code 👍 I guess you are right with the rule of five idea. And then there is the "throwing in destructors"-problem and the issue with destructors of base classes. Regards, |
😆 I will try to convince my colleagues of c++14 support in TwinCAT at the lunch table ;-). I prefer easy to read code, too. But that lecture encouraged me "learn to master the tools you use".
Just to make sure anyone could read it. No one would tell a carpenter to always use a handsaw just because a circular saw will cut his finger faster. |
I rather have no C++14 support than some custom implementation by Beckhoff
(No offense ;-)). There are already some pitfalls like the implementation
of references. References in TwinCAT modules have their own address. I
actually checked - The standard doesn't say anything about that. In every
other system `&refX == &X`. Not in TwinCAT.
Or the sprintf function that didn't support floats until recently.
It's not only in programming with the guidelines. Just look at the colour
coding of cables in electronics. It is safer if everyone understands it. I
agree with your tools argument but also like the "Don't be too clever" rule
for beautiful code.
Regards
Michael
|
I am absolutely with you. "Clever coding" is as stupid as "Clever cable handling". However if you want to be allowed to handle cables, you have_to learn the cable codings. In commit a4f2064 you can see even clever "rule of zero" has its pitfalls ;-). I still think there is some error in VC++2015 std::bind/placeholders/std::unique_ptr implementation. This article sounds promising but even with VS2015 Update 3 I got the same error so I rewrote AdsHandle in commit b1d306e |
moved from #35:
xift wrote:
Sidenote: AdsClient.h does not compile with Visual Studio 2015.
It doesn't like the HandleGuard.
return AdsHandleGuard {new uint32_t {handle}, std::bind(&ReleaseHandle, address, port, std::placeholders::_1)};
No instance of constructor "std::unique_ptr<_Ty, _Dx>::unique_ptr [with _Ty=uint32_t, _Dx=std::_Binder &>]" matches the argument list.
Argument types are: (uint32_t , std::_Binder<std::_Unforced, void ()(AmsAddr address, long port, uint32_t *handle), const AmsAddr &, long &, const std::_Ph<1> &>)
You seem to be quite familiar with modern C++. Do you often use ? I know what bind does but I have never had the opportunity to use it. I just don't think about that. How did you start using it?
The text was updated successfully, but these errors were encountered: