User Profile

Collapse

Profile Sidebar

Collapse
Ian Simpson
Ian Simpson
Last Activity: Jan 11 '12, 05:03 PM
Joined: Jan 11 '11
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Got the answer from another forum. Apparently a reference of an object is what is returned from a function in VB.NET, if that object is not a basic type. So there is no deep-copy going on when you return an object from a function.
    See more | Go to post

    Leave a comment:


  • Is Object Returned by Reference from Function?

    Hello,

    This should be a fairly common question, but I haven't found a straightforward answer anywhere.

    If I instantiate an object within a function in VB.NET and return it, does it return it be reference or by value. IE - should I be worried about performance if I write something like this:

    Code:
    Public Function ret_obj_func() As big_object
        Dim ret_obj As New big_obj(<lots of stuff>)
    ...
    See more | Go to post

  • So I suppose you mean doing something like this.
    Code:
    Service_Processor::process_response(Message_Object* msg)
    {
       thread_queue.push(GetCurrentThread());
       if (thread_queue.size() > 0)
       {
          SuspendThread();
       }
       //Execute some callbacks or processing
       thread_queue.pop();
       if (thread_queue.size() > 0)
       {
          thread_queue.pop().Resume();
    ...
    See more | Go to post

    Leave a comment:


  • Ian Simpson
    started a topic CSingleLock Waiting Threads Execute in Order?
    in C

    CSingleLock Waiting Threads Execute in Order?

    Hello everyone,

    I have an application where multiple threads get passed to a processing method from a port. This method creates a CSingleLock on a CMutex object to ensure that only one thread executes at a time. Is there a way to ensure that the threads execute in the same order that they call the method?

    IE - if there are 5 threads waiting on the same CMutex is there a way to ensure that the next thread that obtains...
    See more | Go to post

  • Ian Simpson
    started a topic STA, MTA conflict warning
    in .NET

    STA, MTA conflict warning

    Hello everyone,

    I recently started writing a C++/CLI wrapper for a native c++ library. I'm now getting this compile warning

    Code:
    "warning LNK4249: directive '/CLRTHREADATTRIBUTE:STA' conflicts with command line; ignored"
    My c++/cli wrapper is set up for MTA in the linker's command line arguments, but I have no idea what file or project is trying to give the STA directive.

    I did enough...
    See more | Go to post

  • Ian Simpson
    replied to Enum with name string, best implementation
    in C
    Only if the user is defining the child classes, right? In my case the child classes will be defined within the library.
    See more | Go to post

    Leave a comment:


  • Ian Simpson
    replied to Enum with name string, best implementation
    in C
    Wait, I might be a little confused, but it seems to me that in both cases you have to recompile and redistribute the library. In one case I add an enum and an element to the string array, and in the other you add a class. These message subtypes need no different formatting methods or members different from the other subtypes and I can't see how the user code would be impacted by adding a couple of elements to the class.

    If these message...
    See more | Go to post

    Leave a comment:


  • Ian Simpson
    replied to Enum with name string, best implementation
    in C
    Thanks Mr. cats, the replies helped me process my options. I think the final code will have an enum wrapped in a class with a string array, and I'll force the user to access the enum through the class and use the class like a virtual singleton.

    Your suggestion is perfect, but the example I gave was over-simplified; in this case the message with 400+ types is already inheriting from a message base class and a type in its own right....
    See more | Go to post

    Leave a comment:


  • Ian Simpson
    replied to Enum with name string, best implementation
    in C
    In a simple eample, the user code will be calling a method send:
    Code:
    Library::send(MsgType, MsgData);
    There are about 400+ possible message types. Inside the library method I need to convert the MsgType argument into the corresponding string.

    So perfect scenario, the user (in the code, not during run-time) passes a custom type that displays all options (in vs with intellisense) and is restricted to those options, and then...
    See more | Go to post

    Leave a comment:


  • Ian Simpson
    replied to Enum with name string, best implementation
    in C
    I don't like that as much. People will be using my code in a library and I like them to be able to see all the possible members somehow.

    Thanks for the reply though
    See more | Go to post

    Leave a comment:


  • Ian Simpson
    started a topic Enum with name string, best implementation
    in C

    Enum with name string, best implementation

    Hi Everyone,

    I've been browsing around for solutions to how to have an enum that gives me a name string. Some rather complicated ones can be found on the gamedev forum and Code Project.

    I am thinking about simply writing a script that takes a list of names and generates a class like so.
    Code:
    class GangstaEnum
    {
    public:
       int VanillaIce = 0;
       int MrT = 1;
       int MrRogers = 2;
    ...
    See more | Go to post
No activity results to display
Show More
Working...