### Function Macro

# GLib assert_cmpmem

since: 2.46

#### Declaration

    #define g_assert_cmpmem (
      m1,
      l1,
      m2,
      l2
    )

#### Description

Debugging macro to compare memory regions. If the comparison fails, an error message is logged and the application is either terminated or the testcase marked as failed.

The effect of `g_assert_cmpmem (m1, l1, m2, l2)` is the same as `g_assert_true (l1 == l2 && memcmp (m1, m2, l1) == 0)`. The advantage of this macro is that it can produce a message that includes the actual values of `l1` and `l2`.

`m1` may be `NULL` if (and only if) `l1` is zero; similarly for `m2` and `l2`.

      g_assert_cmpmem (buf->data, buf->len, expected, sizeof (expected));

Available since: 2.46

This function is not directly available to language bindings.

#### Parameters

`m1`

  Type: `-`

  Pointer to a buffer.

`l1`

  Type: `-`

  Length of `m1`.

`m2`

  Type: `-`

  Pointer to another buffer.

`l2`

  Type: `-`

  Length of `m2`.