CLR anyone?

Started by
11 comments, last by pascalosti 17 years, 8 months ago
I have to relearn c++ in clr anyone know a good reference (other then msdn) or help me out below. The final project i have to convert some metric units to the messed up stuff. I just need to know how to read and print number and string (the convert from string to int throws me). and if calling a function is different. #include "stdafx.h" #include <string> using namespace System; int main(array<System::String ^> ^args) { string word; float somenumber; Console::WriteLine(L"Welcome"); Console::ReadLine(word); return 0; }
Advertisement
whoa what the hell is clr?
Whats the ^ symbol doing here? "array<System::String ^> ^args"
Whats the L doing here?? "Console::WriteLine(L"Welcome");"

Thats not C++ more liek C+/-
Allways question authority......unless you're on GameDev.net, then it will hurt your rating very badly so just shut the fuck up.
He's probably talking about C++/CLI.

Have a look here to start with: http://msdn.microsoft.com/msdnmag/issues/06/00/PureC/default.aspx
Quote:Original post by PhilMorton
Whats the L doing here?? "Console::WriteLine(L"Welcome");"
The L prefix is used to create a Unicode string literal. It's actually valid in both C++ and C++/CLI.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
im pretty sure its clr

new -> project -> visualc++ clr -> clr console application

console::Writeline
and
console::Readline

doesnt work in win32 console application
or general console
CLR is the Common Language Runtime. I haven't messed with it as of yet, but it seems to be a major part of the newer functions and data types for higher security in applications. It's covered pretty extensively in the MS PSDK.

Although the need for better security has raised it's ugly head for MS all too often, I sometimes start wondering if they just want to see how incredibly confusing they can make it to code "their way".
CLR is the Common Language Runtime. It's basically the .NET runtime and allows multiple languages do be used in one project. Now I program in C#, not C++, but from what I recall ^ is basically just like * (meaning it's a pointer), except it points to stuff in the managed space. And the L seems to be equivalent to C#'s @, which causes the string to be interpreted literally instead of taking escape characters into account.
Quote:Original post by PhilMorton
whoa what the hell is clr?
Whats the ^ symbol doing here? "array<System::String ^> ^args"
Whats the L doing here?? "Console::WriteLine(L"Welcome");"

Thats not C++ more liek C+/-

You're half right. It isn't C++ at all. Good eye, I'll bet you get lots of gold stars at school.

OP: You are targetting the CLR, but you are actually programming in C++/CLI. Don't worry too much about the distinction. yaroslavd is right about the ^, and promit is right about the L, in case either of those are confusing you as well.

You mention that string conversions are throwing you off, but your code doesn't actually have any. Do you have any thoughts as to how to proceed? Perhaps some code that doesn't work like you'd expect?

CM
C++/CLI aka Managed C++ isn't portable. Taking that into consideration, if you want to create cross-platform solutions, it would be better to use either straight C++ or C# and Mono.
Rob Loach [Website] [Projects] [Contact]
Quote:Original post by Rob Loach
C++/CLI aka Managed C++ isn't portable. Taking that into consideration, if you want to create cross-platform solutions, it would be better to use either straight C++ or C# and Mono.


C++/CLI and Managed C++ are not the samething, C++/CLI is ECMA standardized (soon to be joint ISO standardized) language & language binding for standard C++ to .NET. Infact there is a implementation of the C++/CLI standard for mono/gcc in the works.

Managed C++ is an older, inferior predessessor to C++/CLI which was exclusively to VC++ 2k3 .NET.

This topic is closed to new replies.

Advertisement