Sujet : Re: question about linker
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 05. Dec 2024, 23:01:14
Autres entêtes
Organisation : None to speak of
Message-ID : <8734j123it.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
User-Agent : Gnus/5.13 (Gnus v5.13)
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.comvoid Void(void) { Void(); } /* The recursive call of the void */