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. C#
  4. Porting C++ to C#: Types

Porting C++ to C#: Types

Scheduled Pinned Locked Moved C#
csharpc++algorithmsquestion
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.
  • R Offline
    R Offline
    Ri Qen Sin
    wrote on last edited by
    #1

    I'm trying to port a C++ algorithm to C#, and Im ust say, this is my first time doing so. Would anyone care to list the corresponidng types from C++ to C#? I've already made some guesses as to what they are: size_t (I assume it is System.Int32) uchar_t (I assume it is System.Byte) uint16_t (UInt16 definitely) Also, I don't think C# can have the void type in a method's parameter list. Method(void *sStart, size_t sLen, void *dStart, size_t dLen) This one line has me puzzled. Thanks in advance.

    ROFLOLMFAO

    P G 2 Replies Last reply
    0
    • R Ri Qen Sin

      I'm trying to port a C++ algorithm to C#, and Im ust say, this is my first time doing so. Would anyone care to list the corresponidng types from C++ to C#? I've already made some guesses as to what they are: size_t (I assume it is System.Int32) uchar_t (I assume it is System.Byte) uint16_t (UInt16 definitely) Also, I don't think C# can have the void type in a method's parameter list. Method(void *sStart, size_t sLen, void *dStart, size_t dLen) This one line has me puzzled. Thanks in advance.

      ROFLOLMFAO

      P Offline
      P Offline
      Parwej Ahamad
      wrote on last edited by
      #2

      You can use as Object

      Parwej Ahamad g_parwez@rediffmail.com

      R 1 Reply Last reply
      0
      • P Parwej Ahamad

        You can use as Object

        Parwej Ahamad g_parwez@rediffmail.com

        R Offline
        R Offline
        Ri Qen Sin
        wrote on last edited by
        #3

        If possible, I would like to avoid object. Object doesn't even make sense since they are all value types.

        ROFLOLMFAO

        P 1 Reply Last reply
        0
        • R Ri Qen Sin

          I'm trying to port a C++ algorithm to C#, and Im ust say, this is my first time doing so. Would anyone care to list the corresponidng types from C++ to C#? I've already made some guesses as to what they are: size_t (I assume it is System.Int32) uchar_t (I assume it is System.Byte) uint16_t (UInt16 definitely) Also, I don't think C# can have the void type in a method's parameter list. Method(void *sStart, size_t sLen, void *dStart, size_t dLen) This one line has me puzzled. Thanks in advance.

          ROFLOLMFAO

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          Behind The Scene wrote:

          Also, I don't think C# can have the void type in a method's parameter list. Method(void *sStart, size_t sLen, void *dStart, size_t dLen)

          The data type is not "void", it's "void*". It's an unspecified pointer.

          --- single minded; short sighted; long gone;

          L 1 Reply Last reply
          0
          • R Ri Qen Sin

            If possible, I would like to avoid object. Object doesn't even make sense since they are all value types.

            ROFLOLMFAO

            P Offline
            P Offline
            Parwej Ahamad
            wrote on last edited by
            #5

            Ok, you can use void * pointer in c#

            Parwej Ahamad g_parwez@rediffmail.com

            1 Reply Last reply
            0
            • G Guffa

              Behind The Scene wrote:

              Also, I don't think C# can have the void type in a method's parameter list. Method(void *sStart, size_t sLen, void *dStart, size_t dLen)

              The data type is not "void", it's "void*". It's an unspecified pointer.

              --- single minded; short sighted; long gone;

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              Right, and a typeless pointer value in C# is an IntPtr. :)

              Luc Pattyn [My Articles]

              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