[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: stack module
From: |
Marc Nieper-Wißkirchen |
Subject: |
Re: stack module |
Date: |
Sat, 23 May 2020 17:55:20 +0200 |
Am Sa., 23. Mai 2020 um 17:39 Uhr schrieb Paul Eggert <address@hidden>:
>
> On 5/23/20 7:36 AM, Marc Nieper-Wißkirchen wrote:
> > The verify also contains a runtime check `assume', which uses
> > __builtin_unreachable if available to help the compiler in optimizing
> > modes.
>
> I wouldn't call 'assume (X)' a "runtime check". It's more an
> anti-runtime-check.
>
> 'assume (X)' is a directive from the programmer to the compiler that X is true
> so that the compiler needn't generate code to test whether X is true. This is
> why 'assume' is in verify.h: it's related to static checking (in this case,
> static checking done by the programmer), not dynamic checking.
>
> Perhaps I should add a comment to this effect....
A combination of assure and assume would be helpful:
#define checked_assume(X) do { assure (X); assume (X); } while (0)
In debug builds, we get assertions and can check our assumptions. In
non-debug (NDEBUG) builds, we just have the compiler hints.
- Re: Add gl_list_remove_last to list/xlist, (continued)
- Re: Add gl_list_remove_last to list/xlist, Bruno Haible, 2020/05/02
- Re: Add gl_list_remove_last to list/xlist, Marc Nieper-Wißkirchen, 2020/05/02
- Re: Add gl_list_remove_last to list/xlist, Bruno Haible, 2020/05/02
- Re: Add gl_list_remove_last to list/xlist, Marc Nieper-Wißkirchen, 2020/05/02
- Re: Add gl_list_remove_last to list/xlist, Marc Nieper-Wißkirchen, 2020/05/22
- Re: stack module, Bruno Haible, 2020/05/23
- Re: stack module, Marc Nieper-Wißkirchen, 2020/05/23
- Re: stack module, Bruno Haible, 2020/05/23
- Re: stack module, Marc Nieper-Wißkirchen, 2020/05/23
- Re: stack module, Paul Eggert, 2020/05/23
- Re: stack module,
Marc Nieper-Wißkirchen <=
- Re: stack module, Paul Eggert, 2020/05/23
- Re: stack module, Marc Nieper-Wißkirchen, 2020/05/23
- Re: stack module, Paul Eggert, 2020/05/23
- Re: stack module, Marc Nieper-Wißkirchen, 2020/05/23
- Re: stack module, Paul Eggert, 2020/05/23
- Re: stack module, Marc Nieper-Wißkirchen, 2020/05/23
- Re: stack module, Bruno Haible, 2020/05/23
- Re: stack module, Paul Eggert, 2020/05/23
- Re: stack module, Marc Nieper-Wißkirchen, 2020/05/24
- Re: stack module, Paul Eggert, 2020/05/24