bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: io.c incompatible pointer between public.read_func and ssize_t(*)()


From: Eli Zaretskii
Subject: Re: io.c incompatible pointer between public.read_func and ssize_t(*)() with c23
Date: Sun, 11 Aug 2024 07:41:24 +0300

> From: arnold@skeeve.com
> Date: Sat, 10 Aug 2024 21:56:30 -0600
> Cc: bug-gawk@gnu.org
> 
> I think the attached patch does the trick. I'm a little loath to
> remove the casts entirely.

The comment you are removing clearly says that the issue the cast is
trying to solve is with ancient systems whose prototype of 'read'
either doesn't exist or is not identical/compatible with 'readfunc'.
If this is the issue, then a trivial wrapper around 'read' is IMO
cleaner:

  static ssize_t wrap_read (int fd, void *buf, size_t size)
  {
     return read (fd, buf, size);
  }

Then you could simply say

  iop->public.read_func = wrap_read;

and be done.

Casts are less clean, and can even be dangerous if the actual
signature is really different.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]