Click here to Skip to main content
15,867,781 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
trønderen21-Sep-20 2:47
trønderen21-Sep-20 2:47 
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 
James Curran wrote:
But, all of this ignores one basic truth of code: ALL LOOPS END!
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.

Lots of embedded infinite loops won't even survive a change of battery. Yet the problem is the same: A test like "while (battery power is available) {...}" has a fairly low probablity of being able to perform a loop exit.

Larger systems, e.g. running databases, may have UPS systems that allow them to do a controlled shutdown, such as to write in-memory logs to stable storage. Lots of servers, both web servers and other kinds of servers, are stateless and have no data to save between requests. They sit waiting for a request, process it, and sit down waiting for the next request. There is nothing to do if the machine is turned off, the process is forcefully terminated, or a power outage occurs. So why should they have a loop exit handling? It has no meaning. Their purpose is to run indefinitely. If it stops, it stops within its loop.
GeneralRe: while(true) is not fun Pin
James Curran21-Sep-20 6:06
James Curran21-Sep-20 6:06 
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 

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.