Click here to Skip to main content
15,885,216 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: while(true) is not fun Pin
Bob Beechey20-Sep-20 20:49
Bob Beechey20-Sep-20 20:49 
GeneralRe: while(true) is not fun Pin
c6jones72020-Sep-20 22:21
c6jones72020-Sep-20 22:21 
GeneralRe: while(true) is not fun Pin
#realJSOP20-Sep-20 23:52
mve#realJSOP20-Sep-20 23:52 
GeneralRe: while(true) is not fun Pin
glennPattonWork320-Sep-20 23:55
professionalglennPattonWork320-Sep-20 23:55 
GeneralRe: while(true) is not fun Pin
Marc Clifton21-Sep-20 2:58
mvaMarc Clifton21-Sep-20 2:58 
GeneralRe: while(true) is not fun Pin
James Curran21-Sep-20 3:29
James Curran21-Sep-20 3:29 
GeneralRe: while(true) is not fun Pin
trønderen21-Sep-20 4:04
trønderen21-Sep-20 4:04 
GeneralRe: while(true) is not fun Pin
James Curran21-Sep-20 6:06
James Curran21-Sep-20 6:06 
Quote:
Because no device with embedded code will last forever. So you could include some sort of "while (this device is not being decomposed into its constituents for recycling purposes) {...}". The question is how the device can perform this test, and take the proper actions to terminate the loop.


Even the most standard loop (for(int i=0; i < str.Length; ++i)) will not survive a power cut, so that's not the case we are interested in.

Most embedded systems still have a "power" switch, which is not hard-wired to the power, but instead, starts the "power-down" procedure. Hence:
while (!shutting_down()) {}
Truth,

James

GeneralRe: while(true) is not fun Pin
trønderen22-Sep-20 0:44
trønderen22-Sep-20 0:44 
GeneralRe: while(true) is not fun Pin
obermd21-Sep-20 3:55
obermd21-Sep-20 3:55 
GeneralRe: while(true) is not fun Pin
trønderen21-Sep-20 4:05
trønderen21-Sep-20 4:05 
GeneralRe: while(true) is not fun Pin
Member 1409260522-Sep-20 21:50
Member 1409260522-Sep-20 21:50 
GeneralOoops. So this should be fun Pin
honey the codewitch20-Sep-20 3:59
mvahoney the codewitch20-Sep-20 3:59 
GeneralRe: Ooops. So this should be fun Pin
OriginalGriff20-Sep-20 4:37
mveOriginalGriff20-Sep-20 4:37 
GeneralRe: Ooops. So this should be fun Pin
Matthew Dennis20-Sep-20 4:40
sysadminMatthew Dennis20-Sep-20 4:40 
GeneralRe: Ooops. So this should be fun Pin
Sander Rossel20-Sep-20 5:04
professionalSander Rossel20-Sep-20 5:04 
GeneralRe: Ooops. So this should be fun Pin
honey the codewitch20-Sep-20 6:08
mvahoney the codewitch20-Sep-20 6:08 
GeneralRe: Ooops. So this should be fun Pin
Sander Rossel20-Sep-20 6:27
professionalSander Rossel20-Sep-20 6:27 
GeneralRe: Ooops. So this should be fun Pin
honey the codewitch20-Sep-20 6:34
mvahoney the codewitch20-Sep-20 6:34 
GeneralRe: Ooops. So this should be fun Pin
Sander Rossel20-Sep-20 6:38
professionalSander Rossel20-Sep-20 6:38 
GeneralRe: Ooops. So this should be fun Pin
honey the codewitch20-Sep-20 6:42
mvahoney the codewitch20-Sep-20 6:42 
GeneralRe: Ooops. So this should be fun Pin
Sander Rossel20-Sep-20 6:47
professionalSander Rossel20-Sep-20 6:47 
GeneralRe: Ooops. So this should be fun Pin
honey the codewitch20-Sep-20 6:49
mvahoney the codewitch20-Sep-20 6:49 
GeneralRe: Ooops. So this should be fun Pin
Sander Rossel20-Sep-20 23:10
professionalSander Rossel20-Sep-20 23:10 
GeneralRe: Ooops. So this should be fun Pin
Nelek20-Sep-20 7:36
protectorNelek20-Sep-20 7:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.