From: Eli Zaretskii <eliz@gnu.org>
To: dalanicolai <dalanicolai@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: What is the recommended way to find out the number of arguments passed to a module function?
Date: Wed, 10 Jan 2024 22:10:20 +0200 [thread overview]
Message-ID: <83il41lzkj.fsf@gnu.org> (raw)
In-Reply-To: <CACJP=3mw8tcNXWeH3=Ge5OuDBQ=Jwc9+yYxFejg5weBPXYU4bQ@mail.gmail.com> (message from dalanicolai on Wed, 10 Jan 2024 21:05:22 +0100)
> From: dalanicolai <dalanicolai@gmail.com>
> Date: Wed, 10 Jan 2024 21:05:22 +0100
>
> Ah okay, well I am completely new to C, so I am still finding out things (e.g. I have not 'actively' used
> ptrdiff yet).
> But indeed the 'nargs' just give the number of passed args (obviously).
>
> I had checked the 'sizeof' the args array when passing an argument and without passing an
> argument,
> and it was the same. Then the docs mention that NARGS is the 'required' number of arguments,
> I had misunderstood it a little (of course the required number is variable, but somehow I assumed it
> would be 1 in this case). So sometimes I overlook the 'obvious', and because I had spent some time
> on testing
> things already, I decided to just ask here.
The args[] array gets allocated exactly to accommodate nargs
arguments, so you should never access args[] beyond the index nargs-1.
> Anyway, as usual, thanks for your quick and helpful answer!
You're welcome.
next prev parent reply other threads:[~2024-01-10 20:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-10 19:01 What is the recommended way to find out the number of arguments passed to a module function? dalanicolai
2024-01-10 19:15 ` Eli Zaretskii
2024-01-10 20:06 ` dalanicolai
[not found] ` <CACJP=3mw8tcNXWeH3=Ge5OuDBQ=Jwc9+yYxFejg5weBPXYU4bQ@mail.gmail.com>
2024-01-10 20:10 ` Eli Zaretskii [this message]
2024-01-10 20:41 ` dalanicolai
2024-01-10 20:43 ` dalanicolai
2024-01-11 6:02 ` Eli Zaretskii
2024-01-12 0:52 ` Emanuel Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83il41lzkj.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=dalanicolai@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.