U
U
Uno di Palermo2018-05-18 04:23:52
Programming
Uno di Palermo, 2018-05-18 04:23:52

How do "old school" programmers write: while true or while 1?

Here is such a question. And is there a performance difference? And why did it happen that in terms of semantics 1 == true? Isn't it bad to produce entities?

Answer the question

In order to leave comments, you need to log in

7 answer(s)
A
Alexander, 2018-05-18
@alexr64

And why did it happen that in terms of semantics 1 == true?

Historically. 0 and 1, there is no tension and there is tension, lies and prada. Here from here .
Old school programmers consider zero to be false and everything else to be true.

V
Vasya, 2018-05-18
@haramba

Old-school programmers are looking for an option not to use while(true), and also not to use continue and break unnecessarily.
Read Podbelsky "Programming in C",
C Forever

U
Uno, 2018-05-18
@Noizefan

There are no old-school and new-school programmers. There are good programmers, and there are Indians.

F
forspamonly2, 2018-05-18
@forspamonly2

old school programmers write goto !
and true historically is minus 1. so that in the additional code all bits are set to one and bit operations can be used as logical ones.

A
Alexander Skusnov, 2018-05-18
@AlexSku

there is another alternative: for (;;)

P
pfg21, 2018-05-18
@pfg21

while (1)
for "why", look for the old joke that replaced true with 0 with a very rare probability :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question