[Top][All Lists]

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

bug#11935: XINT etc. should be functions

From: Paul Eggert
Subject: bug#11935: XINT etc. should be functions
Date: Fri, 14 Jun 2013 23:43:30 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6

On 06/13/2013 01:08 PM, Stefan Monnier wrote:
> Can't we use something like
> #define FUNCTION_OF_MACRO(fun, type_in, type_out) \
>   LISP_INLINE type_out (fun) (type_in x) { return lisp_h_##fun (x); }

Sure, though we need to adjust that a bit,
as the function can take multiple args, and it might return
void (where the 'return' keyword must be omitted).

The following variant works for me, and the attached combined
patch implements this suggestion.

/* Define NAME as a lisp.h inline function that returns TYPE and has
   arguments declared as ARGDECLS and passed as ARGS.  ARGDECLS and
   ARGS should be parenthesized.  Implement the function by calling
   lisp_h_NAME ARGS.  */
#define LISP_MACRO_DEFUN(name, type, argdecls, args) \
  LISP_INLINE type (name) argdecls { return lisp_h_##name args; }

/* like LISP_MACRO_DEFUN, except NAME returns void.  */
#define LISP_MACRO_DEFUN_VOID(name, argdecls, args) \
  LISP_INLINE void (name) argdecls { lisp_h_##name args; }

Attachment: inline4o.txt
Description: Text document

reply via email to

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