Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. L”” or to “” Strings

L”” or to “” Strings

Scheduled Pinned Locked Moved Managed C++/CLI
tutorialquestion
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    earlgraham
    wrote on last edited by
    #1

    When you see System::String used with “xxx” in some text or example you almost always see the ‘L’ macro in from of the text (L”xxx”). However if I do not use the ‘L’, It seems to have no affect to my String values. Am I missing something?

    String ^MyText = "Blah";
    //or
    String ^MyOtherText = L"Blah";

    Same right?

    Programmer Glenn Earl Graham Austin, TX

    M 1 Reply Last reply
    0
    • E earlgraham

      When you see System::String used with “xxx” in some text or example you almost always see the ‘L’ macro in from of the text (L”xxx”). However if I do not use the ‘L’, It seems to have no affect to my String values. Am I missing something?

      String ^MyText = "Blah";
      //or
      String ^MyOtherText = L"Blah";

      Same right?

      Programmer Glenn Earl Graham Austin, TX

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      I don't agree with my own reply :) I think the compiler now automatically uses the appropriate type when it knows the context. String ^MyText = "Blah"; The literal "Blah" ends up in the assembly metadata as a CString^, just as using the 'S' prefix did in VS2003. hmm - maybe I need to look in the MSIL to see if there's a difference :) Mark -- modified at 15:55 Monday 16th July, 2007

      Mark Salsbery Microsoft MVP - Visual C++ "Great job team! Head back to base for debriefing and cocktails."

      I G 2 Replies Last reply
      0
      • M Mark Salsbery

        I don't agree with my own reply :) I think the compiler now automatically uses the appropriate type when it knows the context. String ^MyText = "Blah"; The literal "Blah" ends up in the assembly metadata as a CString^, just as using the 'S' prefix did in VS2003. hmm - maybe I need to look in the MSIL to see if there's a difference :) Mark -- modified at 15:55 Monday 16th July, 2007

        Mark Salsbery Microsoft MVP - Visual C++ "Great job team! Head back to base for debriefing and cocktails."

        I Offline
        I Offline
        iddqd515
        wrote on last edited by
        #3

        Its the same MSIL whether you use L or not.

        M 1 Reply Last reply
        0
        • I iddqd515

          Its the same MSIL whether you use L or not.

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          Cool! Thanks for saving me the time ;) Cheers! Mark

          Mark Salsbery Microsoft MVP - Visual C++ "Great job team! Head back to base for debriefing and cocktails."

          1 Reply Last reply
          0
          • M Mark Salsbery

            I don't agree with my own reply :) I think the compiler now automatically uses the appropriate type when it knows the context. String ^MyText = "Blah"; The literal "Blah" ends up in the assembly metadata as a CString^, just as using the 'S' prefix did in VS2003. hmm - maybe I need to look in the MSIL to see if there's a difference :) Mark -- modified at 15:55 Monday 16th July, 2007

            Mark Salsbery Microsoft MVP - Visual C++ "Great job team! Head back to base for debriefing and cocktails."

            G Offline
            G Offline
            G Haranadh
            wrote on last edited by
            #5

            Mark Salsbery wrote:

            String ^MyText = "Blah"

            Hi, What this "^" cap symbol represents? where it is useful?


            Nice talking to you. :-O
            If you judge people, you have no time to love them. -- Mother Teresa

            I 1 Reply Last reply
            0
            • G G Haranadh

              Mark Salsbery wrote:

              String ^MyText = "Blah"

              Hi, What this "^" cap symbol represents? where it is useful?


              Nice talking to you. :-O
              If you judge people, you have no time to love them. -- Mother Teresa

              I Offline
              I Offline
              iddqd515
              wrote on last edited by
              #6

              Its a handle. Used like a pointer for pointing to managed objects on the managed heap. Its pretty fundamental to writing managed code with C++/CLI.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups