Deutsch   English   Français   Italiano  
<8734j123it.fsf@nosuchdomain.example.com>

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: Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: question about linker
Date: Thu, 05 Dec 2024 14:01:14 -0800
Organization: None to speak of
Lines: 28
Message-ID: <8734j123it.fsf@nosuchdomain.example.com>
References: <vi54e9$3ie0o$1@dont-email.me> <vibr1l$vvjf$1@dont-email.me>
	<vic73f$1205f$1@dont-email.me> <20241129142810.00007920@yahoo.com>
	<vicfra$13nl4$1@dont-email.me> <20241129161517.000010b8@yahoo.com>
	<vicque$15ium$2@dont-email.me> <vid110$16hte$1@dont-email.me>
	<vifcll$1q9rj$1@dont-email.me> <vifiib$1s07p$1@dont-email.me>
	<87ldwx10gv.fsf@bsb.me.uk> <vimtt4$27vv$1@dont-email.me>
	<vin7r2$49d1$2@dont-email.me> <vinalt$5qoh$1@dont-email.me>
	<vipgns$rjqn$1@dont-email.me> <viqbl8$12mum$1@dont-email.me>
	<viqfuh$131h8$2@dont-email.me>
	<87ttbj12ec.fsf@nosuchdomain.example.com>
	<viqq95$164ug$1@dont-email.me> <vis132$1ig7f$1@dont-email.me>
	<vis49u$1ja8l$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Thu, 05 Dec 2024 23:01:15 +0100 (CET)
Injection-Info: dont-email.me; posting-host="7392a70ceafa2370b36a4bd73810300d";
	logging-data="1945602"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1//ccCBHwDVbXVFyLvE0Qew"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:I4mpE8PvB380BIjqDjSJIvS9JOc=
	sha1:EqjlqDVmqejCn7iB9lO88a9HfTI=
Bytes: 2641

Bart <bc@freeuk.com> writes:
[...]
> In the Linux kernel code (as of 10 years ago), there were about
> 140,000 gotos, I think about once in 150 lines on average.
[...]

In the current Linux kernel code (as of commit 896d8946da97,
Thu 2024-12-05), I count 202301 occurrences of the word "goto"
in *.h and *.c files, an average of one goto per 171.8 lines.

This doesn't account for occurrences of "goto" in comments, string
literals, or other contexts that are not actual goto statements, or
for *.h and *.c files that are included in the Linux git repo but
are not actually part of the kernel.  But it should be close, and
the numbers are not surprising considering 10 years of development.

Linux kernel code commonly uses gotos for early exits when an error
is detected.

There is now some Rust code in the Linux kernel.  Rust does not
have a goto statement.

This post is not intended as any kind of commentary on whether
gotos are good or bad.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */