| Deutsch English Français Italiano |
|
<vdgjkc$2mhpi$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Vir Campestris <vir.campestris@invalid.invalid>
Newsgroups: comp.lang.c
Subject: Re: Code guidelines
Date: Tue, 1 Oct 2024 11:41:16 +0100
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <vdgjkc$2mhpi$1@dont-email.me>
References: <vb6v1t$3b5mb$1@dont-email.me> <vb726n$3b4rq$1@dont-email.me>
<vb736j$3b5mb$2@dont-email.me> <vb75g9$3bntp$1@dont-email.me>
<vb77tn$3bu07$3@dont-email.me> <vb7d6l$3d5mv$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 01 Oct 2024 12:41:16 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="dd58e08109278a091646e6aec7fb8140";
logging-data="2836274"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/M3r/3/P/T8WBd2g/EIkqsCGNQ4/Fas9A="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:rOYZibuOZzxAx4cL2fbNlHHNSUI=
Content-Language: en-GB
In-Reply-To: <vb7d6l$3d5mv$1@dont-email.me>
Bytes: 1867
On 03/09/2024 17:23, Thiago Adams wrote:
<snip>
> but...maybe, is better to be a little redundant here?
> I think I prefer to leave "obj->member1->member2 && " even if I know
> it should not be null.
>
> if (obj->member1 &&
> obj->member1->member2 &&
> obj->member1->member2->member3)
> {
>
> }
I think I'd prefer to _omit_ the check that obj->member1->member2 isn't
null.
If the code is running correctly that check will never trigger, and is
redundant, and will slow things slightly.
But if the code is not running correctly it will conceal the bug by
preventing the crash.
But circumstances may vary. You probably don't want to crash an
autopilot if at all possible!
Andy