-
Notifications
You must be signed in to change notification settings - Fork 4
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
Clumsy Code #8
Comments
|
I tell you that I completely rewrote your code. It is much shorter and clearer now. (approx half the length of yours). I also fixed some other issues. |
Looking forward to your project. If you already fixed my code, you could also create a pull request. |
I did not fix your code. |
@Elmue I am Noob of SCPI now. |
Hello Short Arrow |
Hello klasyc: When I publish my project which downloads data via USB from the oscilloscope using your completely rewritten code, would you set a link to my project in your project description? It does much more than copying wave forms from an oscilloscope. It displays analog and digital channels and has decoders for several data formats like for example UART, SPI, I2C, CAN Bus, Math operations, noise filter and much more. |
@Elmue: If you create a pull request to fix the issues you addressed, I will reference your project in my library. Currently, you are only criticizing my project and advertising your own, which I don't like. |
@Elmue In many cases, to ensure transparency, third parties or end users can read the historical background of the project in the form of |
@klasyc: I already wrote you that I can NOT make a pull request.
Exactly! |
OK Elume, thank you for your feedback. I was hoping that you will show us your code. Finally, I got some time to fix the addressed issues myself:
|
I will publich it as soon at it is ready.
I already wrote you how to do this! I wrote on 21 december:
So look at the DllImport of SetupDiEnumDeviceInterfaces() Why are you not able to change the DllImport of WriteFile() to pass the structure NativeOverlapped in exactly the same way and get rid of the useless unsafe ??? It is sooooooooo easy ! |
Yes, I know that I can pass the |
The reason is that you are mixing native Windows API with .NET Task stuff. Have you ever programmed Overlapped Read/Write in C++ before? |
Thank you for your suggestion, I cannot understand, why I didn't get that idea myself... My previous C++ version of the code looked exactly like that... So the library is finally without |
Excellent! |
1.)
There is no reason to use a GCHandle in your code.
If you read the documentation that this is for the opposite purpose: When UNmanaged code accesses Managed resources.
But you not do this in your code.
2.)
There is absolutely no need to ever use the keyword "unsafe" in your code and require to compile you code as unsafe.
3.)
It does not make sense to use hundreds of "async" and "Task" if you use "await" in the same function.
You did not understand asynchronous programming.
If you use "await" in the same function you block the calling thread. This is not asynchronous programming anymore.
The idea of asynchronous programming is that one thread waits for another and not one function blocks itself.
4.)
Why pass a CancellationToken to each and every function if you have a timeout of 1500 ms ?
Who will ever cancel such a short operation ?
The text was updated successfully, but these errors were encountered: