I'm assuming there's no easier way to do this. Is thread locking really automatic? Am I misreading the documentation? [CODE]from threading import Thread make_thread = lambda fn, *args: Thread(None, fn, None, args).start() def my_fn(*args): for arg in args: print (arg) make_thread(my_fn, "toaster", "ovens") [/CODE]

Member Avatar
Member Avatar
+0 forum 6

What are some hints or tips on writing efficient functions? I read about converting the code to assembly, and I've also read about the stack and functions. However, I fail to understand how data stored higher can be accessed before the end on a FIFO stack, as any local variable can be accessed at any point in scope. Obviously I'm misunderstanding something.

Member Avatar
Member Avatar
+0 forum 7

I read about a coding style where not one variable is changed. Everything must stay constant. I don't remember what it's called, but it's the bomb. I never realized this little project would be [I]so easy[/I]. Here is a 98 line calculator that supports [B]()^*/+-[/B]. If you find a bug, please don't hesitate to comment. It doesn't handle invalid input well and forgets to loop, keeping the code short. You'll get a bunch of debug output and the result should be after RESULT. Now to the main question: Did I do this right? Other questions: Could anything be better? Is …

Member Avatar
Member Avatar
+1 forum 15

I was reading a post somewhere on this site about making a type-dynamic list and came up with this. The issue is I'm thinking it's leaking memory when the list grows. Finally, are there any ways to improve this code? [CODE]#include <iostream> using namespace std; class DynamicType { public: union { int integer; char* string; }; enum { is_int, is_string } what_type; }; class DynamicTypeList { DynamicType* data; DynamicType* data_begin; DynamicType* data_end; int len; int actual_len; int increment; void expand() { int oldlen = actual_len; actual_len += increment; DynamicType* temp = new DynamicType[actual_len]; data = data_begin; for (int i = …

Member Avatar
Member Avatar
+0 forum 5

Is this decent code, hacks, or somewhere in between? :)

Member Avatar
Member Avatar
+0 forum 3

My application freezes randomly with no error output. I've been beating my head over it's code and don't want to continue working on it until this problem is resolved. I'm thinking it's a synchronization problem. I've attached the source code. Any help would be greatly appreciated.

Member Avatar
Member Avatar
+0 forum 6

The End.