Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Thomas Koenig Newsgroups: comp.arch Subject: Re: Computer architects leaving Intel... Date: Sat, 31 Aug 2024 09:24:59 -0000 (UTC) Organization: A noiseless patient Spider Lines: 30 Message-ID: References: <2024Aug30.161204@mips.complang.tuwien.ac.at> <2024Aug30.195831@mips.complang.tuwien.ac.at> Injection-Date: Sat, 31 Aug 2024 11:25:00 +0200 (CEST) Injection-Info: dont-email.me; posting-host="d78104b68bd6a6a358e9a21ee9fe1069"; logging-data="1028748"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18sdxQcxLXjqf+alc5Uzw+pe3gOUWvDgEc=" User-Agent: slrn/1.0.3 (Linux) Cancel-Lock: sha1:O1a52qEsMv144SmVAN1sERLA9Ak= Bytes: 1675 Bernd Linsel schrieb: > The clang/gcc maintainers' POV violates the first part of Postel's Law: > > > Be liberal in what you accept, and conservative in what you send. > > Life would be a lot easier if they just provided a -WUB option that > warns and explains *any* construct that the compiler may regard as UB. Maybe a bit more elaborate: #include int main() { int i; sscanf("%d", &i); return 0; } Should this be warned about? Or what about void foo(int *a) { *a ++; } Two possible cases of undefined behavior here: a could be an invalid pointer, and the arithmetic operation could overflow.