User Profile
Collapse
-
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. -
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>)
-
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();
Leave a comment:
-
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... -
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"
I did enough... -
Only if the user is defining the child classes, right? In my case the child classes will be defined within the library.Leave a comment:
-
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...Leave a comment:
-
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....Leave a comment:
-
In a simple eample, the user code will be calling a method send:
Code:Library::send(MsgType, MsgData);
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...Leave a comment:
-
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 thoughLeave a comment:
-
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;
No activity results to display
Show More
Leave a comment: