A try/exception clause block video would be nice! Great great video series!!!
@MikeShah2 ай бұрын
Cheers! Indeed, that's on the todo list!
@__hannibaalbarca__ Жыл бұрын
Thanks; Very Kind small examples “ the big things came out of tiny things”. Thanks again for the methodology of how to understand and learn something.
@MikeShah Жыл бұрын
Cheers!
@enriquemorenoroldan84022 жыл бұрын
Thanks again for your videos Mike!
@MikeShah2 жыл бұрын
Cheers!
@reptilicusrex4748 Жыл бұрын
Thanks for the great explanation.
@MikeShah Жыл бұрын
Cheers!
@GaryChike2 жыл бұрын
It's just a matter of time before someone comes up with a programming language called "42" 😂 Great explanation Mike!
@MikeShah2 жыл бұрын
Cheers! Thanks Gary 😁
@VoidloniXaarii Жыл бұрын
Thank you very much. Sorry if stupid question, how do these asserts relate to the ones in Google's test framework asserts... If any?
@MikeShah Жыл бұрын
Similar idea, you want to assert and catch during testing things that must be true. Google provides an abstraction layer to help make some of the testing ideas more clear.
@VoidloniXaarii Жыл бұрын
@@MikeShah thank you!
@VoidloniXaarii Жыл бұрын
@@MikeShah thank you so much for all your enlightened teachings!
@bsdooby2 жыл бұрын
How do you setup your C++ code such that it can be tested on an ad hoc basis? E.g. Java has maven with test profiles; I struggle a bit doing something similar with C++...I guess one has to resort to CMake (or similar build environments) to invoke test suits (?) And D has compiler switches which invoke unit tests.
@MikeShah2 жыл бұрын
Previously I've used Catch framework with a CMake to do a test build, alongside a debug and release build. D's compiler switches are a 'killer feature' in my opinion, and one of the reason you are seeing me make the DLang series :) Visual Studio is one IDE I know about that also has built-in test frameworks to emulate what D has (and essentially what Catch does as well). See an example here: docs.microsoft.com/en-us/visualstudio/test/writing-unit-tests-for-c-cpp?view=vs-2022
@bsdooby2 жыл бұрын
Thanks for these valuable hints! Will def. check them out.
@berlin-unlocked10 ай бұрын
Great video! But) From my experience in the field, c assert() is a bad thing for the project. In Release variant asserts are compiled out, so you miss the checks. The checks were performed only in Debug variant. So you have different code between Debug and Release variants. C asserts can work good only in a big company, where they do extensive testing for debug AND release variants. My best practice: just do not use c asserts. If there is a suspect for an existence of an error, perform a mature param check with if (...) {print log, handle error / throw exception} and just avoid using c asserts... But static_assert is a great stuff)
@MikeShah10 ай бұрын
Agree to prefer static_assert when possible. Assert is for developers during development, at run-time in release if errors are handled this is where exceptions are useful. May depend on domain, but I recommend liberal use of assertions -- and you are correct we do not typically want an assert in release that crahes the program 🙂
@axelBr14 ай бұрын
Came to the comments to see if anyone pointed out that asserts are only compiled in for debug code. I still keep using them though as during development I want the application to fail and force me to fix it. Of course it does mean that you end up having the assert followed by error checking and handling code. But then again, all my coding is for personal use.
@despender26782 ай бұрын
@@axelBr1 In many programming languages and development environments, assert is disabled by default in release mode. It can be manually enabled in release mode (properties->C/C++->preprocessor->preprocessor definition->remove NDEBUG if in VS). After this, assert will work in release build mode. Before doing this, it's advisable to check whether something is tied to NDEBUG, if it's in the project (although according to the C standard it's intended exclusively for assert). If so, you can do it through define your assert.