Click here to Skip to main content
15,914,452 members
Home / Discussions / C#
   

C#

 
QuestionLoading combobox Pin
Tanuja1237-Mar-07 5:01
Tanuja1237-Mar-07 5:01 
QuestionDon't understand the meaning of this "for" loop Pin
Goalie357-Mar-07 4:24
Goalie357-Mar-07 4:24 
AnswerRe: Don't understand the meaning of this "for" loop Pin
Pete O'Hanlon7-Mar-07 4:35
mvePete O'Hanlon7-Mar-07 4:35 
AnswerRe: Don't understand the meaning of this "for" loop Pin
pbraun7-Mar-07 4:37
pbraun7-Mar-07 4:37 
AnswerRe: Don't understand the meaning of this "for" loop Pin
Stefan Troschuetz7-Mar-07 4:38
Stefan Troschuetz7-Mar-07 4:38 
AnswerRe: Don't understand the meaning of this "for" loop Pin
PIEBALDconsult7-Mar-07 4:40
mvePIEBALDconsult7-Mar-07 4:40 
Answerexpressionless not dataless Pin
Ennis Ray Lynch, Jr.7-Mar-07 5:59
Ennis Ray Lynch, Jr.7-Mar-07 5:59 
AnswerRe: Don't understand the meaning of this "for" loop Pin
Luc Pattyn7-Mar-07 8:02
sitebuilderLuc Pattyn7-Mar-07 8:02 
Hi,

I'm one of those programmers who use for(;;) to create what some call an
"infinite loop". I have several comments on the previous entries:

1. As a long time C programmer and having used many different compilers, I dont
write code such as if (true) ... or while(true)... simply because there are compilers
that insist on generating some silly warning ("logic expression is constant" or
something similar); I expect the same for "for(;true;)" which I never tried;
I never got warnings on for(;;) so that is the only form I use; and whoever has seen
it once, knows immediately what the intentions are.

2. I dont use a semi-colon when I want an empty code block; when I need an empty code block, I write one, that is {}.
reason: those two brackets are clearly intentional and adding/deleting one of them
would result in a compilation error, whereas a single semi-colon is easily overlooked
(so it makes it harder to read and understand the code), and adding/removing one
may yield a new source that compiles, but behaves quite differently.

3. although we all know what is meant by "infinite loop", there actually is no
such thing; everything will come to an end: either energy will run out, or
someone will stop your system, or your hardware will fail, or your software
(app or OS) will crash. Guess which one it will be ?
If you are in pursuit of an infinite loop, my first recommendation would be not
to use software in it.


for(;;) Console.WriteLine("I like C#");





Luc Pattyn

[My Articles]
Questionmanipulate list view Pin
shamsteady7-Mar-07 4:01
shamsteady7-Mar-07 4:01 
QuestionBinding Business objects to datagridview Pin
Farhan Ejaz7-Mar-07 3:22
Farhan Ejaz7-Mar-07 3:22 
Questionhow to capture image that scaned with scanner program? Pin
hdv2127-Mar-07 2:58
hdv2127-Mar-07 2:58 
Question.net 2.0 generic type collection - loop Pin
arkiboys7-Mar-07 2:47
arkiboys7-Mar-07 2:47 
AnswerRe: .net 2.0 generic type collection - loop Pin
User 66587-Mar-07 3:02
User 66587-Mar-07 3:02 
GeneralRe: .net 2.0 generic type collection - loop Pin
Dario Solera7-Mar-07 5:03
Dario Solera7-Mar-07 5:03 
GeneralRe: .net 2.0 generic type collection - loop Pin
User 66587-Mar-07 5:27
User 66587-Mar-07 5:27 
GeneralWith .Net 2.0 not so much Pin
Ennis Ray Lynch, Jr.7-Mar-07 6:01
Ennis Ray Lynch, Jr.7-Mar-07 6:01 
Questionwhat is this error about? Pin
pashitech7-Mar-07 2:31
pashitech7-Mar-07 2:31 
AnswerRe: what is this error about? Pin
Pete O'Hanlon7-Mar-07 2:48
mvePete O'Hanlon7-Mar-07 2:48 
GeneralRe: what is this error about? Pin
pashitech7-Mar-07 2:53
pashitech7-Mar-07 2:53 
GeneralRe: what is this error about? Pin
Colin Angus Mackay7-Mar-07 3:17
Colin Angus Mackay7-Mar-07 3:17 
GeneralRe: what is this error about? Pin
User 66587-Mar-07 3:27
User 66587-Mar-07 3:27 
GeneralRe: what is this error about? [modified] Pin
Pete O'Hanlon7-Mar-07 3:29
mvePete O'Hanlon7-Mar-07 3:29 
GeneralRe: what is this error about? Pin
Guffa7-Mar-07 3:58
Guffa7-Mar-07 3:58 
GeneralRe: what is this error about? Pin
Pete O'Hanlon7-Mar-07 4:05
mvePete O'Hanlon7-Mar-07 4:05 
QuestionMultiple opennings of same form at a time. Pin
Janu_M7-Mar-07 2:20
Janu_M7-Mar-07 2:20 

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.