Am Mo., 2. Sept. 2024 um 13:58 Uhr schrieb Bruno Haible <br...@clisp.org>:

> I did:
> >       vma-prot: Add tests.
> >       * tests/test-vma-prot.c: New file.
> >       * modules/vma-prot-tests: New file.
>
> Oops, I forgot some parentheses. (I will never understand why the '&' and
> '|'
> operators, which are most meaningful on unsigned integer values, not on
> boolean values, have lower precedence than '=='. Maybe I should ask Dennis
> Ritchie's former Bitwise Operations Manager...)
>

You can find some history in [1], especially in the section "Neonatal C".

Best wishes,

Marc

--

[1] http://cm.bell-labs.co/who/dmr/chist.html



>
>
> 2024-09-02  Bruno Haible  <br...@clisp.org>
>
>         vma-prot tests: Strengthen test.
>         Found by Coverity.
>         * tests/test-vma-prot.c (main): Fix typo.
>
> diff --git a/tests/test-vma-prot.c b/tests/test-vma-prot.c
> index 24b5b1873a..dc100d3af3 100644
> --- a/tests/test-vma-prot.c
> +++ b/tests/test-vma-prot.c
> @@ -65,7 +65,7 @@ main (void)
>        {
>          prot = get_vma_prot (mem, 1024*1024);
>          ASSERT (prot != -1);
> -        ASSERT (prot == VMA_PROT_READ | VMA_PROT_WRITE);
> +        ASSERT (prot == (VMA_PROT_READ | VMA_PROT_WRITE));
>
>          size_t pagesize = sysconf (_SC_PAGESIZE);
>          if (pagesize <= 512*1024
>
>
>
>
>

Reply via email to