• _go32_dpmi_meminfo libc reference errata?

    From Frank Sapone (emoaddict15@gmail.com) [via djgpp@delorie.com]@djgpp@delorie.com to djgpp on Wed Sep 9 12:27:27 2026
    From Newsgroup: comp.os.msdos.djgpp

    I was running some code with -Wall -Wextra and I was using the example phys_mem_left() code in your documentaiton for _go32_dpmi_meminfo
    located at http://www.delorie.com/djgpp/doc/libc/libc_438.html

    In here it mentions "The only field that is guaranteed to have useful
    data is available_memory. Any unavailable field has -1 in it.".-a The
    compiler complained on this line from example code: if (info.available_physical_pages != -1)

    This makes sense because they are u_long's so therefore they cannot have negative values in them.-a I imagine that you want to check != 0 or is
    the example completely incorrect?

    Frank

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Eli Zaretskii (eliz@gnu.org) [via djgpp@delorie.com]@djgpp@delorie.com to djgpp on Wed Sep 9 20:04:19 2026
    From Newsgroup: comp.os.msdos.djgpp

    Date: Wed, 9 Sep 2026 12:27:27 -0400
    From: "Frank Sapone (emoaddict15@gmail.com) [via djgpp@delorie.com]" <djgpp@delorie.com>

    I was running some code with -Wall -Wextra and I was using the example phys_mem_left() code in your documentaiton for _go32_dpmi_meminfo
    located at http://www.delorie.com/djgpp/doc/libc/libc_438.html

    In here it mentions "The only field that is guaranteed to have useful
    data is available_memory. Any unavailable field has -1 in it.".-a The compiler complained on this line from example code: if (info.available_physical_pages != -1)

    This makes sense because they are u_long's so therefore they cannot have negative values in them.-a I imagine that you want to check != 0 or is
    the example completely incorrect?

    No, the example is correct. If the compiler complains, cast -1 to
    u_long.
    --- Synchronet 3.22a-Linux NewsLink 1.2