|
Yeah, it's good to be reckless sometimes. Send me the codez and I'll go away.
Regards,
Rob Philpott.
|
|
|
|
|
I figure every function is a callback function - it's just a matter of perspective.
Real programmers use butterflies
|
|
|
|
|
It's an "entry point"; "Main" wasn't something that was part of a "response", other than "call static Main in class x".
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
If you take the view that your application is an interruption to a busy operating system's schedule, but it figures it should let you do your thing before you whine and get all bitchy about it, then yes, it is a callback function.
Software Zen: delete this;
|
|
|
|
|
Are you asking if it's masculine or feminine?
I've no idea, and I don't want to look, just in case.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
Only if used as such, e. g. in this code:
#include <iostream>
using namespace std;
static int call_countdown = 3;
typedef int (*MyCallbackFun)();
int foo(MyCallbackFun cb, int count)
{
static int foo_counter = 0;
++foo_counter;
cout << "enter foo[" << foo_counter <<"]: " << count << endl;
int result = cb();
cout << "exit foo[" << foo_counter << "]: " << result << endl;
return result;
}
int bar()
{
static int bar_counter = 0;
++bar_counter;
cout << "bar[" << bar_counter << "]" << endl;
return -1;
}
int main()
{
static int call_counter = 0;
++call_counter;
cout << "enter main[" << call_counter << "]" << endl;
int result = 0;
if (call_counter < 5)
{
result = (call_counter>2)
? foo(bar, call_counter)
: foo(main, call_counter);
}
cout << "exit main[" << call_counter << "]: " << result << endl;
return call_counter;
}
You can test it here: https://www.onlinegdb.com/online_c++_compiler[^] or trust me that the output is:
enter main[1]
enter foo[1]: 1
enter main[2]
enter foo[2]: 2
enter main[3]
enter foo[3]: 3
bar[1]
exit foo[3]: -1
exit main[3]: -1
exit foo[3]: 3
exit main[3]: 3
exit foo[3]: 3
exit main[3]: 3
The tricky bit about this is that by using main() as a callback function, you're also using it recursively, which complicates matters considerably: it's easy to mess up the code and get an endless recursion. (that's why I added counters and output in every function)
It's doable, but definitiely not a good idea.
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
No. It's a state in the Northeast.
Oh Well.....
|
|
|
|
|
Ever seen an Antelope? It's incredible how they get that little ladder up to the nest window.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Then they flea to the circus.
It's been 6 months since I joined the gym and there's been no progress. I'm going there tomorrow in person to find out what's really going on!
JaxCoder.com
|
|
|
|
|
... or just roll along with the dung beetles
after many otherwise intelligent sounding suggestions that achieved nothing the nice folks at Technet said the only solution was to low level format my hard disk then reinstall my signature. Sadly, this still didn't fix the issue!
|
|
|
|
|
I gnu[^] you'd turn that into a pun!
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
They do not have opposable thumbs so they could never use a ladder.
Therefore they canteloupe you melon head!
I, for one, like Roman Numerals.
|
|
|
|
|
I have seen an earwig on cold days.
And back in the earliest days of pay bathrooms, it was just a centipede, before it went up to a dime.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
No, but I've seen a horse fly!
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
had to turn off my sense of reality for a while but Terminator Dark Fate was better than I was expecting.
yeah the same story again again (updated, twists), but watchable none the less.
and anyway being robots (or whatever) it's ok for the bad-then-good-then-bad-then-good... characters to keep coming back. (as I said lower the reality filter)
so far one of the few remaining movie series they haven't turned into some sort of moral [clinical depression inducing] statement (the batman - dark knight and on) or made purely to show off the latest in special effects (latest john wick - cgi ad nauseam with barely any discernible plot). they also don't overdo whatever is the latest hollywood PC sickness
after many otherwise intelligent sounding suggestions that achieved nothing the nice folks at Technet said the only solution was to low level format my hard disk then reinstall my signature. Sadly, this still didn't fix the issue!
|
|
|
|
|
I suspect it's a "Brain-out-bottle-of-wine-in" movie.
I've watched a few of those over the years!
I'll just wait till it's out of the cinema.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Check your brain at the door movies!
The Running Man - another Arnold classic.
(Whoever thought of casting Richard Dawson as a smarmy game show host was a genius. I wonder how he came up with the idea? )
Everybody loves at least one of these movies - what is yours?
I, for one, like Roman Numerals.
|
|
|
|
|
lopatir wrote: latest john wick - cgi ad nauseam with barely any discernible plot
I was made to sit through that one a few months ago. I honestly don't recall seeing a movie with so little plot. I haven't seen the first two, but clearly I haven't missed anything.
Oh, and how does Keanu Reeves keep getting work?
|
|
|
|
|
|
i liked My Own Private Idaho
Real programmers use butterflies
|
|
|
|
|
Yeah, as far as Terminator movies go I enjoyed it.
modified 23-Jan-20 2:03am.
|
|
|
|
|
Last Monday, the CP Daily News brought the link to Elon Musk Says He’ll Put A Million People on Mars By 2050[^]. This set me thinking: Recycling water is quite straightforward. Recycling oxygen not so.
I do not have enough information to even estimate how may tons of oxygen a million humans require a day. (A ton is a million grams, one gram per person.) Can anyone put me on the right track?
Next question: How many plants does it take to produce a ton of oxygen a day? Obviously, a huge pine tree will produce more than, say, a tomato plant. I guess that plants will have to double as both oxygen and food sources; there wouldn't be room of huge forests within that plastic bubble. Do food plants vary a lot in their oxygen prodction capabilities? With Mars being roughly speaking at 1.5 times the Earth's distance from the sun, solar radiation is at 40-45% of Earth levels; I guess that could affect the photosynthesis.
When the type and required number of plants, of various kinds, have been determined, we could try to estimate how much water would be bound in these plants and their soil. Transporting that water from earth would be a major taks. So would be an effort to break it loose from the south pole ice-cap and transport it the 2500 km to equatorial land, melt it and heat it up to a temperature suitable for the plants. With no oxygen available, we can't use diesel trucks for transportation, or any tool requiring oxygen for cutting the ice.
(We obviously could cover half of the Martian surface with solar cells to produce electricity for electrolyzing the south pole ice cap, rather than using the water for growing plants. That is certainly not in the "sustainable" group of alternatives - and how much solar panels would it require? I suspect that the panels would all have to be brought from Earth.)
I really liked the kind of analysis made in The World Without Us[^] by Alan Wiesman, and wish that someone would make a similarly scientifically founded evaluation of the realism of a one million people Mars colony. Well, I suspect that it could easily end up more like Solar FREAKING Roadways, Are they REAL?[^] (i.e. not quite as respectuful as Alan Weisman's approach). Either would be interesting reading!
|
|
|
|
|
The engineering required for long-term presence on Mars is much more than provision of food, water, air, and power. On Earth, the Earth's magnetic field and atmosphere do a good job of protecting us. Mars has neither. The colonists would have to dig down to a depth of a few metres in order to protect themselves (and their crops) from radiation. We also have no idea how the radiation would affect the micro-biome that all of us carry around inside us. There are indications that quite a few diseases may be caused by the replacement in the gut of some benign bacteria by less benign varieties.
All in all, I would be very surprised if humanity has any permanent colony on Mars in 2050, to say nothing of a million people.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Daniel Pfeffer wrote: The engineering required for long-term presence on Mars is much more than provision of food, water, air, and power. Certainly! That is why I wish someone with a similar broad scientific background (and as many contacts in the scientific community) as Alan Weisman would take on such a project. When I read The World Without Us, there were quite a few points I never had considered before. On Mars there must be ten times as many!
It certainly would be fascinating read, but I guess it would be sort of depressing to a large number of SciFi fans.
|
|
|
|
|
Check out Biosphere 2 - Wikipedia[^].
That's where they basically attempted to do this right here on good ol' Earth and failed quite spectacularly.
Creating a biosphere is extremely difficult (a massive understatement).
|
|
|
|