Liste des Groupes | Revenir à cl c |
On 07/11/2024 13:23, Bart wrote:On 06/11/2024 14:50, David Brown wrote:On 05/11/2024 23:48, Bart wrote:>On 05/11/2024 13:29, David Brown wrote:>int small_int_sqrt(int x) {
if (x == 0) return 0;
if (x < 4) return 1;
if (x < 9) return 2;
if (x < 16) return 3;
unreachable();
}"unreachable()" is a C23 standardisation of a feature found in most high-end compilers. For gcc and clang, there is __builtin_unreachable(), and MSVC has its version.>
So it's a kludge.
You mean it is something you don't understand? Think of this as an opportunity to learn something new.You don't seem to understand a 'kludge' is. Think of it as a 'hack', something bolted-on to a language.
At least my code will never 'run off the end of a function'.'dummyelse' is a special version of 'else' that tells the compiler that control will (should) never arrive there. ATM it does nothing but inform the reader of that and to remind the author. But later stages of the compiler can choose not to generate code for it, or to generate error-reporting code.You are missing the point - that is shown clearly by the "int.min".
>
You have your way of doing things, and have no interest in learning anything else or even bothering to listen or think.Ditto for you.
Your bizarre hatred of C is overpowering for youDitto for your hatred of my stuff.
Les messages affichés proviennent d'usenet.