Psst! Did you know DevelopmentNow is a mobile web site design agency?

Contact us for help mobilizing your site, or to sign up for our beta Mobile Web SDK!
all groups > visual c > february 2004 >

visual c : Strings


Reza A
2/19/2004 8:58:49 AM
Can anyone explain why when Visual Studio creates code that has to use
strings it puts a S before every string?
Example

System::Console::WriteLine(S"Hello World");

<.>
2/19/2004 10:09:03 AM
S is a .NET string, right?

Wheras L is wide.

Dont ya love this "feature" of C++.

There are 354893258237598584584 types of strings. Pick your poison.


[quoted text, click to view]

Tim Smelser
2/20/2004 2:56:57 PM
[quoted text, click to view]

The S means that it is a string literal which can provide a boost in
performance. See:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmxspec/html/vcManagedExtensionsSpec_11_2.asp

for details.

Tim
--
Tim Smelser - MVP Visual C#
Reza A
2/20/2004 7:38:30 PM
The book doesn't cover anything of that sort, so I dont know what you're
talking about. Care to explain some more?

[quoted text, click to view]

Hendrik Schober
2/20/2004 8:56:49 PM
[quoted text, click to view]

Is it a book on Managed C++?
This
System::Console::WriteLine(S"Hello World");
seems to be what's called MC++. If
your book is on std C++, you won't
find this in there. In that case
you should decide what you want to
learn and either (a) don't use MC++
or (b) buy a book on MC++.

FWIW, in std C++ you do this instead:
std::cout << "Hello, World!";

[quoted text, click to view]

Schobi

--
SpamTrap@gmx.de is never read
I'm Schobi at suespammers dot org

"Sometimes compilers are so much more reasonable than people."
Scott Meyers

AddThis Social Bookmark Button