Author |
Message |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Wed Nov 10, 2004 1:01 pm Post maybe stupid Post subject: |
 |
|
|
|
<comment>Nice post #666. </comment> _________________ Performance is often the art of cheating carefully. - James Gosling
|
|
Back to top |
|
 |
Bak ?ls -s 0 in

Age:26 Gender: Joined: Jun 11 2004 Posts: 1826 Location: USA Offline
|
Posted: Wed Nov 10, 2004 5:31 pm Post maybe stupid Post subject: |
 |
|
|
|
(answers attached so as to not ruin problem)
answers
answers.txt - 0.47 KB
File downloaded or viewed 60 time(s)
|
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Wed Nov 10, 2004 11:21 pm Post maybe stupid Post subject: |
 |
|
|
|
Good but there are more.
|
|
Back to top |
|
 |
tansey Novice
Joined: Nov 03 2004 Posts: 53 Offline
|
Posted: Thu Nov 11, 2004 9:27 pm Post maybe stupid Post subject: |
 |
|
|
|
besides the 3 thrown up there, couldn't you also overload the class of a's '=' operator to set it to 0 if rvalue is 1?
|
|
Back to top |
|
 |
Bak ?ls -s 0 in

Age:26 Gender: Joined: Jun 11 2004 Posts: 1826 Location: USA Offline
|
Posted: Thu Nov 11, 2004 11:50 pm Post maybe stupid Post subject: |
 |
|
|
|
perhaps, but that would be operator overloading again. I wonder what function the while(a) would call... does it do a != 0 so operator!= or perhaps it does a cast to a bool... if so than what would it do in c... where there are no bool's (integer cast?). Ekted probably would know.
Similarly you could use #define in a few different ways to get the desired result.
A different solution would be to start a different thread that does
while (1)
a = 0;
forever and that should do it... assuming a is a global variable... unfortunately I can't seem to find a simple c++ example showing multithreading, so I don't know exactly what the syntax would be... I guess it's the idea that counts though.
|
|
Back to top |
|
 |
50% Packetloss Server Help Squatter

Age:40 Gender: Joined: Sep 09 2003 Posts: 561 Location: Santa Clarita, California Offline
|
Posted: Fri Nov 12, 2004 1:49 am Post maybe stupid Post subject: |
 |
|
|
|
#define while(a) while(0)
#define b++ break
Good game sons!!
Edit: Damn, didnt read your post, guess you already found these answers
|
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Fri Nov 12, 2004 9:19 am Post maybe stupid Post subject: |
 |
|
|
|
Clue:
volatile int a;
|
|
Back to top |
|
 |
SuSE Me measures good

Joined: Dec 02 2002 Posts: 2307 Offline
|
|
Back to top |
|
 |
50% Packetloss Server Help Squatter

Age:40 Gender: Joined: Sep 09 2003 Posts: 561 Location: Santa Clarita, California Offline
|
Posted: Fri Nov 12, 2004 4:24 pm Post maybe stupid Post subject: |
 |
|
|
|
You could use __asm to have the program self-modify itself. Maybe even have another thread edit the value of a while the program is in the loop, I dont know enough about multi-threading though. I tried looking up the volatile stuff and its beyond me.
|
|
Back to top |
|
 |
Bak ?ls -s 0 in

Age:26 Gender: Joined: Jun 11 2004 Posts: 1826 Location: USA Offline
|
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Sun Nov 14, 2004 8:45 pm Post maybe stupid Post subject: |
 |
|
|
|
Good work everyone. This concludes the exercise.
|
|
Back to top |
|
 |
D1st0rt Miss Directed Wannabe

Age:37 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Sun Nov 14, 2004 10:49 pm Post maybe stupid Post subject: |
 |
|
|
|
couldn't you just step over it in a debugger? _________________
|
|
Back to top |
|
 |
1stStrike Cute like a kitty
Joined: Dec 28 2002 Posts: 427 Offline
|
Posted: Sun Nov 14, 2004 10:54 pm Post maybe stupid Post subject: |
 |
|
|
|
psh. programming! who needs programming anyway? software is for the weak!
|
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Sun Nov 14, 2004 11:04 pm Post maybe stupid Post subject: |
 |
|
|
|
D1s, I don't think you quite understand the debugger commands. You can't just skip a section of code, that would cause quite a few problems and wouldn't be too useful. The only call it skipping because it's going too fast to see. (My wacko explanation) _________________ This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
|
|
Back to top |
|
 |
D1st0rt Miss Directed Wannabe

Age:37 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Sun Nov 14, 2004 11:06 pm Post maybe stupid Post subject: |
 |
|
|
|
ok, I really have no knowledge of debuggers since nothing I've done has been complex enough to require serious use... I just saw the "step over" button in VS
|
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Mon Nov 15, 2004 3:12 am Post maybe stupid Post subject: |
 |
|
|
|
Cyan~Fire wrote: | D1s, I don't think you quite understand the debugger commands. You can't just skip a section of code, that would cause quite a few problems and wouldn't be too useful. The only call it skipping because it's going too fast to see. (My wacko explanation) |
Yuo can change the value of EIP any time you like, as long as you know what you are doing. This effectively performs a JMP.
|
|
Back to top |
|
 |
Dr Brain Flip-flopping like a wind surfer

Age:39 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Mon Nov 15, 2004 7:15 am Post maybe stupid Post subject: |
 |
|
|
|
In assembly debuggers, you can change the PC register and that will skip commands. I'm not sure I've ever seen that functionality on a 8086 debugger, but it's probably there.
But you can do it on some embedded system debuggers, because they give you the ability to manually change all of the registers. _________________ Hyperspace Owner
Smong> so long as 99% deaths feel lame it will always be hyperspace to me
|
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Mon Nov 15, 2004 9:52 am Post maybe stupid Post subject: |
 |
|
|
|
EIP is the program counter for Intel. In VC you can edit registers simply by typing new values for them.
|
|
Back to top |
|
 |
Dr Brain Flip-flopping like a wind surfer

Age:39 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Mon Nov 15, 2004 10:12 am Post maybe stupid Post subject: |
 |
|
|
|
Oh? Interesting. I've been working mostly with Motorola chips thus far.
Never really used Microsoft's debugger, either.
|
|
Back to top |
|
 |
Purge Episode I > Eposide III Jar-Jar is kool

Age:35 Gender: Joined: Sep 08 2004 Posts: 2019 Offline
|
Posted: Mon Nov 15, 2004 3:18 pm Post maybe stupid Post subject: |
 |
|
|
|
Damn smart people...
|
|
Back to top |
|
 |
|