(01-31-2016, 05:47 AM)Strange Leader Wrote: Is it cool to just jump straight into C++ with no other language knowledge?
I have the opinion that it doesn't really matter as long as you are determined and willing enough to learn and make the progress. It's not going to be easy to transition into C++ from no prior knowledge of any language because you will be dealing with the nuances of the features of the language itself along with contradictions between standards of the language, different compilers, having to understand the memory model and manage it manually, along with understanding the high level workings of the STL, and how they work in the background in order to use such functions, objects, and containers properly, all at the same time you are just trying to familiarize yourself with the control structures and programming logic which is fundamentally similar across the majority of programming languages. C would be a better choice in my opinion to start off with coming from no prior programming experience, because you don't have classes, you don't need to understand the STL, all of the keywords that C++ has in comparison to C, etc... And although C and C++ are not quite 100% interleaving in terms of some core concepts, it should be easier to understand how C++ objects within the STL work when you transition from a language like C to C++. You might tend to want to use pointers rather than references though, and iterators, but eventually as you learn more about C++ you will transition into all of that, along with smart pointers. You'll also learn about allocators and many other things.
(01-31-2016, 05:51 AM)Killpot Wrote: http://stackoverflow.com/questions/35109...0_35109689
You should be using the RAII-like class for those COM interface/object pointers: https://msdn.microsoft.com/en-us/library/ezzw7k98.aspx
However, where does the function fail; where does it return to the caller? What HRESULT do you get? You should have some way to access that result rather than just checking if it's S_OK everywhere, for scalability reasons if anything, or even logging functionality which will help in larger projects. Writing code that doesn't scale well is always a good source of problems and bugs.
Additionally, I think a more practical approach is to not assume that the specific runtime is installed. Revert over to something like ICLRMetaHost::EnumerateInstalledRuntimes to choose an appropriate runtime. Does it break at this part?
hr = pClrRuntimeInfo->IsLoadable(&fLoadable);
if ((hr == S_OK) && fLoadable)
This might prove to be a useful function for you: https://msdn.microsoft.com/en-us/library....110).aspx