namespace { foo = FooClass(); }
wtf does this accomplish?
namespace { foo = FooClass(); }
wtf does this accomplish?
I'd still love to see an example of using this where it makes sense.
I understand this idea that so many new things are championing of booleans having 3 or 4 values. It makes good sense to have deterministic handling of undefined or undeclared variables and to support some math oriented logic operations. BUT they really need to stop calling them booleans. C booleans win, 0 = false, every other bit pattern = true . You can't have undefined and 'gate not found' in a logic gate. All these new variables are nice for OO programming and plugging in java beans and .net whatever modules and webshit, but they are not booleans.
@ammoQ said:
In other languages, where this is possible, it's usefull because the inner function sees the variables of the outer function. For example, if it was possible in C, we could write something like this:
....
not an impressive example where this looks very desirable. In fact, in OO languages, it's rather useless and it's use would probably indicate the "functional decomposition" antipattern.
Ok I'm on the same page as you. I understand this concept. I've had to use lisp variants before. I just couldn't think of using it in c.
Do you care to explain any of this trampolining or a good use for defining a function in a function? I've used pointers to functions but I've always defined them in the normal fashion.
Thanks for clearing that up. However that brings up the question:
You can declare a function in the body of another function??
This won't compile and I don't know why. I'm sure it's some basic c++ thing that I should know but I'm stumped. Oh don't worry this isn't actual code. Just a test I typed up.
int globalvar;
class testme
{
public:
testme();
testme(int a);
void incr();
};
int main()
{
testme myClass();
//testme myClass(4); // using this constructor will make it compile
myClass.incr();
return 0;
}
testme::testme()
{
globalvar=0;
}
testme::testme(int a)
{
globalvar=0;
}
void testme::incr()
{
globalvar++;
}
What is my WTF? What is special about the default constructor?
any kind of serial or model number on the remote?
[quote user="overmyhead"]
$to = 'correctemail@correctdomain.com'
[/quote]
Maybe this isn't an edit and what the code actually had? instead of "$correctemail"...