Re: “Booleans Considered Harmful”

Liste des GroupesRevenir à c programming 
Sujet : Re: “Booleans Considered Harmful”
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.programming
Date : 22. May 2025, 23:33:49
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <100o8od$3mk15$3@dont-email.me>
References : 1 2
User-Agent : Pan/0.162 (Pokrosvk)
On Thu, 22 May 2025 11:14:17 +0200, Julio Di Egidio wrote:

But we know better: the one best practice that would be relevant there
is *do not use magic values*.

I think the writer was trying to make a point about cryptic actual-
argument values. But that is an issue that applies to other types besides
booleans, and is easily solved by passing arguments by keyword. Compare
his example

    saveUser(user, true, false);

with something more like

    saveUser
      (
        user,
        sendWelcomeEmail := true,
        verified := false
      );

Date Sujet#  Auteur
22 May 25 * “Booleans Considered Harmful”12Lawrence D'Oliveiro
22 May 25 +* Re: “Booleans Considered Harmful”4Julio Di Egidio
22 May 25 i+- Re: “Booleans Considered Harmful”1Julio Di Egidio
22 May 25 i`* Re: “Booleans Considered Harmful”2Lawrence D'Oliveiro
23 May 25 i `- Re: “Booleans Considered Harmful”1Julio Di Egidio
22 May 25 +* Re: “Booleans Considered Harmful”3David Brown
22 May 25 i`* Re: “Booleans Considered Harmful”2Julio Di Egidio
22 May 25 i `- Re: “Booleans Considered Harmful”1Julio Di Egidio
22 May 25 +- Re: “Booleans Considered Harmful”1Keith Thompson
23 May 25 +* Re: “Booleans Considered Harmful”2JJ
23 May 25 i`- Re: “Booleans Considered Harmful”1Lawrence D'Oliveiro
23 May 25 `- Re: “Booleans Considered Harmful”1Lawrence D'Oliveiro

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal